Skip to content

Commit 5c63623

Browse files
Merge branch 'otel-logging' into dev
2 parents 7d30ae5 + c023afa commit 5c63623

File tree

296 files changed

+23611
-3485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+23611
-3485
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"

.services/jaeger/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM jaegertracing/jaeger:2.5.0
2+
3+
# Copy the configuration file
4+
COPY config.yaml /etc/jaeger/jaeger-config.yaml
5+
COPY ui-config.json /etc/jaeger/config-ui.json

.services/jaeger/config.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
service:
2+
extensions: [jaeger_storage, jaeger_query, healthcheckv2]
3+
pipelines:
4+
traces:
5+
receivers: [otlp/jaeger]
6+
processors: [batch]
7+
exporters: [jaeger_storage_exporter]
8+
telemetry:
9+
resource:
10+
service.name: jaeger
11+
# metrics:
12+
# level: detailed
13+
# readers:
14+
# - pull:
15+
# exporter:
16+
# prometheus:
17+
# host: 0.0.0.0
18+
# port: 8888
19+
logs:
20+
level: info
21+
# TODO Initialize telemetry tracer once OTEL released new feature.
22+
# https://github.com/open-telemetry/opentelemetry-collector/issues/10663
23+
24+
# ttl:
25+
# span_store: 72h
26+
27+
extensions:
28+
healthcheckv2:
29+
use_v2: true
30+
http:
31+
32+
jaeger_query:
33+
storage:
34+
traces: traces_elasticsearch
35+
traces_archive: traces_elasticsearch
36+
ui:
37+
config_file: ./etc/jaeger/config-ui.json
38+
39+
jaeger_storage:
40+
backends:
41+
traces_elasticsearch:
42+
elasticsearch:
43+
server_urls:
44+
- http://tracing-elasticsearch:9200
45+
indices:
46+
# Create a single index per day, with 5 shards per index.
47+
index_prefix: "jaeger-main"
48+
spans:
49+
date_layout: "2006-01-02"
50+
rollover_frequency: "day"
51+
shards: 5
52+
replicas: 1
53+
services:
54+
date_layout: "2006-01-02"
55+
rollover_frequency: "day"
56+
shards: 5
57+
replicas: 1
58+
dependencies:
59+
date_layout: "2006-01-02"
60+
rollover_frequency: "day"
61+
shards: 5
62+
replicas: 1
63+
sampling:
64+
date_layout: "2006-01-02"
65+
rollover_frequency: "day"
66+
shards: 5
67+
replicas: 1
68+
metric_backends:
69+
prometheus_storage:
70+
prometheus:
71+
endpoint: http://prometheus:9090
72+
normalize_calls: true
73+
normalize_duration: true
74+
75+
receivers:
76+
otlp/jaeger:
77+
protocols:
78+
http:
79+
endpoint: 0.0.0.0:4318
80+
grpc:
81+
endpoint: 0.0.0.0:4317
82+
83+
processors:
84+
batch:
85+
86+
exporters:
87+
jaeger_storage_exporter:
88+
trace_storage: traces_elasticsearch

.services/jaeger/ui-config.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"dependencies": {
3+
"dagMaxNumServices": 200,
4+
"menuEnabled": true
5+
},
6+
"monitor": {
7+
"menuEnabled": true
8+
},
9+
"archiveEnabled": true,
10+
"tracking": {
11+
"gaID": "UA-000000-2",
12+
"trackErrors": true
13+
},
14+
"menu": [
15+
{
16+
"label": "About Jaeger",
17+
"items": [
18+
{
19+
"label": "GitHub",
20+
"url": "https://github.com/jaegertracing/jaeger"
21+
},
22+
{
23+
"label": "Docs",
24+
"url": "http://jaeger.readthedocs.io/en/latest/"
25+
}
26+
]
27+
}
28+
],
29+
"search": {
30+
"maxLookback": {
31+
"label": "2 Days",
32+
"value": "2d"
33+
},
34+
"maxLimit": 1500
35+
},
36+
"linkPatterns": [
37+
{
38+
"type": "process",
39+
"key": "jaeger.version",
40+
"url": "https://github.com/jaegertracing/jaeger-client-java/releases/tag/#{jaeger.version}",
41+
"text": "Information about Jaeger release #{jaeger.version}"
42+
},
43+
{
44+
"type": "tags",
45+
"key": "uniqueId",
46+
"url": "https://mykibana.com/uniqueId=#{uniqueId}&traceId=#{trace.traceID}",
47+
"text": "Redirect to kibana to view log"
48+
}
49+
]
50+
}

.services/loki/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM grafana/loki:3
2+
3+
# Copy the configuration file
4+
COPY config.yaml config.yaml
5+
6+
EXPOSE 3100/tcp

.services/loki/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Loki log collector & database
2+
3+
Loki is a log collector & storage engine, consisting of multiple different processes.
4+
To make deployment easy, every process is contained in the same binary and can be enabled individually using the `-target=` flag. Targets may be listed using the `-list-targets` flag.
5+
6+
## Simple scalable deployment
7+
8+
See https://grafana.com/docs/loki/latest/get-started/deployment-modes/#simple-scalable.
9+
10+
Loki’s simple scalable deployment mode separates execution paths into read, write, and backend targets. These targets can be scaled independently, letting you customize your Loki deployment to meet your business needs for log ingestion and log query so that your infrastructure costs better match how you use Loki.
11+
12+
The simple scalable deployment mode can scale up to a few TBs of logs per day, however if you go much beyond this, the microservices mode will be a better choice for most users.
13+
14+
The three execution paths in simple scalable mode are each activated by appending the following arguments to Loki on startup:
15+
16+
-target=write - The write target is stateful and is controlled by a Kubernetes StatefulSet. It contains the following components:
17+
Distributor
18+
Ingester
19+
-target=read - The read target is stateless and can be run as a Kubernetes Deployment that can be scaled automatically (Note that in the official helm chart it is currently deployed as a stateful set). It contains the following components:
20+
Query Frontend
21+
Querier
22+
-target=backend - The backend target is stateful, and is controlled by a Kubernetes StatefulSet. Contains the following components:
23+
Compactor
24+
Index Gateway
25+
Query Scheduler
26+
Ruler
27+
Bloom Planner (experimental)
28+
Bloom Builder (experimental)
29+
Bloom Gateway (experimental)
30+
31+
The simple scalable deployment mode requires a reverse proxy to be deployed in front of Loki, to direct client API requests to either the read or write nodes. The Loki Helm chart includes a default reverse proxy configuration, using Nginx.

.services/loki/config.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# For reference, see https://grafana.com/docs/loki/latest/configuration/
2+
3+
auth_enabled: false
4+
5+
server:
6+
http_listen_port: 3100
7+
8+
common:
9+
instance_addr: 127.0.0.1
10+
path_prefix: /loki
11+
storage:
12+
filesystem:
13+
chunks_directory: /loki/chunks
14+
rules_directory: /loki/rules
15+
replication_factor: 1
16+
ring:
17+
kvstore:
18+
store: inmemory
19+
20+
limits_config:
21+
# Allow user to send structured metadata in push payload.
22+
# Necessary for OTLP push.
23+
allow_structured_metadata: true
24+
25+
schema_config:
26+
configs:
27+
- from: 2020-10-24
28+
store: tsdb
29+
object_store: filesystem
30+
schema: v13
31+
index:
32+
prefix: index_
33+
period: 24h
34+
35+
block_builder:
36+
chunk_target_size: 1MB
37+
max_chunk_age: 3h
38+
39+
ingester:
40+
chunk_idle_period: 3h
41+
42+
storage_config:
43+
filesystem:
44+
directory: /loki/chunks/
45+
46+
distributor:
47+
# Promote the following labels coming from OpenTelemetry input to be indexed.
48+
# Only indexed labels can be filtered on.
49+
# See https://grafana.com/docs/loki/latest/get-started/labels/#default-labels-for-opentelemetry.
50+
otlp_config:
51+
default_resource_attributes_as_index_labels:
52+
- service.name
53+
- environment
54+
- deploy.environment
55+
- k8s.pod.name
56+
- k8s.deployment.name
57+
- k8s.daemonset.name
58+
- k8s.statefulset.name
59+
- k8s.namespace.name
60+
- k8s.job.name
61+
62+
ruler:
63+
alertmanager_url: http://localhost:9093
64+
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
65+
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
66+
#
67+
# Statistics help us better understand how Loki is used, and they show us performance
68+
# levels for most users. This helps us prioritize features and documentation.
69+
# For more information on what's sent, look at
70+
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
71+
# Refer to the buildReport method to see what goes into a report.
72+
#
73+
# If you would like to disable reporting, uncomment the following lines:
74+
#analytics:
75+
# reporting_enabled: false
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM otel/opentelemetry-collector-contrib:0.123.0
2+
3+
COPY ./config.yaml /etc/otelcol-contrib/config.yaml
4+
5+
# OTLP gRPC receiver
6+
EXPOSE 4317
7+
# OTLP http receiver
8+
EXPOSE 4318
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Receivers: Where and how do we receive data.
2+
# =====================================================
3+
receivers:
4+
otlp: # the OTLP receiver the app is sending traces to
5+
protocols:
6+
grpc:
7+
endpoint: 0.0.0.0:4317
8+
http:
9+
endpoint: 0.0.0.0:4318
10+
11+
# Processors: How do we transform our data?
12+
# =====================================================
13+
processors:
14+
# Limit memory consumption by dropping telemetry if necessary. Prevents OOM.
15+
# See https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/memorylimiterprocessor/README.md
16+
memory_limiter:
17+
check_interval: 1s
18+
limit_percentage: 75
19+
spike_limit_percentage: 20
20+
21+
# Groups spans from the same trace before sending it on.
22+
# Minimizes incomplete traces in downstream collectors.
23+
# See https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/groupbytraceprocessor/README.md
24+
groupbytrace:
25+
wait_duration: 5s
26+
num_traces: 10000
27+
num_workers: 1
28+
29+
# Batches telemetry before sending it on, making more effective use of the network.
30+
# See https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/batchprocessor/README.md
31+
batch:
32+
send_batch_size: 8192
33+
timeout: 200ms
34+
metadata_cardinality_limit: 1000
35+
36+
# Exporters: Where we expose/push our processed data to.
37+
# =====================================================
38+
exporters:
39+
# Jaeger's OTLP endpoint.
40+
otlp/jaeger:
41+
endpoint: jaeger:4317
42+
tls:
43+
insecure: true
44+
45+
# Loki's OTLPHTTP endpoint.
46+
# See https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlphttpexporter/README.md
47+
otlphttp/loki:
48+
endpoint: http://loki:3100/otlp
49+
tls:
50+
insecure: true
51+
52+
# Push metrics to Prometheus via remote write.
53+
# The remote write exporter normalizes names and labels.
54+
# See https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/translator/prometheus/README.md
55+
prometheusremotewrite:
56+
endpoint: http://prometheus:9090/api/v1/write
57+
tls:
58+
insecure: true
59+
target_info:
60+
enabled: true
61+
resource_to_telemetry_conversion:
62+
enabled: true # Convert resource attributes to metric labels
63+
64+
# Service: How do we connect our receivers, processors, and exporters?
65+
# =====================================================
66+
service:
67+
pipelines:
68+
traces:
69+
receivers: [otlp]
70+
# Export traces to jaeger and an internal exporter named 'spanmetrics'.
71+
processors: [memory_limiter, groupbytrace, batch]
72+
exporters: [otlp/jaeger]
73+
metrics:
74+
# Receive metrics from our otlp endpoints.
75+
receivers: [otlp]
76+
processors: [memory_limiter, batch]
77+
exporters: [prometheusremotewrite]
78+
logs:
79+
receivers: [otlp]
80+
processors: [memory_limiter, batch]
81+
exporters: [otlphttp/loki]

.services/prometheus/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM prom/prometheus:main
2+
3+
COPY prometheus.yaml /etc/prometheus/prometheus.yml
4+
5+
VOLUME [ "/prometheus" ]
6+
CMD [ "--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus", "--web.enable-otlp-receiver", "--web.enable-remote-write-receiver"]

0 commit comments

Comments
 (0)