Skip to content

Commit 7c69e3d

Browse files
committed
feat: enable otlp metrics
1 parent 8c8324d commit 7c69e3d

1 file changed

Lines changed: 49 additions & 7 deletions

File tree

src/tracer/src/opentelemetry/otel-config-template.yaml

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
receivers:
2+
otlp:
3+
protocols:
4+
grpc:
5+
endpoint: 0.0.0.0:4317
6+
http:
7+
endpoint: 0.0.0.0:4318
8+
29
filelog:
310
include:
411
- "**/*.log"
@@ -55,17 +62,21 @@ receivers:
5562

5663
processors:
5764
batch:
58-
timeout: 6s
65+
timeout: 10s
5966
send_batch_size: 1000
6067
send_batch_max_size: 2000
6168

69+
memory_limiter:
70+
check_interval: 10s
71+
limit_mib: 512
72+
6273
resource:
6374
attributes:
6475
- key: service.name
6576
value: "tracer-logger"
6677
action: insert
6778
- key: service.version
68-
value: "1.1.0"
79+
value: "1.1.1"
6980
action: insert
7081
- key: deployment.environment
7182
value: "production"
@@ -74,7 +85,7 @@ processors:
7485
from_attribute: host.name
7586
action: insert
7687

77-
transform:
88+
transform/logs:
7889
log_statements:
7990
- context: log
8091
statements:
@@ -102,8 +113,22 @@ processors:
102113
- set(attributes["data_stream.namespace"], "namespace")
103114
- set(attributes["data_stream.type"], "record")
104115

116+
transform/metrics:
117+
metric_statements:
118+
- context: datapoint # resource (or use this)
119+
statements:
120+
- set(attributes["trace_id"], "{{trace_id}}")
121+
- set(attributes["span_id"], "{{span_id}}")
122+
- set(attributes["run_id"], "{{run_id}}")
123+
- set(attributes["organization_id"], "{{organization_id}}")
124+
- set(attributes["organization_slug"], "{{organization_slug}}")
125+
- set(attributes["user_id"], "{{user_id}}")
126+
- set(attributes["user_email"], "{{user_email}}")
127+
- set(attributes["pipeline_name"], "{{pipeline_name}}")
128+
- set(attributes["run_name"], "{{run_name}}")
129+
105130
exporters:
106-
otlphttp:
131+
otlphttp/logs:
107132
endpoint: "{{otel_endpoint}}"
108133
headers:
109134
Content-Type: "application/json"
@@ -120,7 +145,19 @@ exporters:
120145
num_consumers: 2
121146
queue_size: 2000
122147
tls:
123-
insecure: true
148+
insecure: false
149+
encoding: json
150+
151+
otlphttp/metrics:
152+
endpoint: "{{otel_endpoint}}"
153+
headers:
154+
x-organization-slug: "{{organization_slug}}"
155+
x-organization-id: "{{organization_id}}"
156+
timeout: 30s
157+
retry_on_failure:
158+
enabled: true
159+
tls:
160+
insecure: false
124161
encoding: json
125162

126163
debug:
@@ -130,10 +167,15 @@ exporters:
130167

131168
service:
132169
pipelines:
170+
metrics:
171+
receivers: [otlp]
172+
processors: [memory_limiter, resource, transform/metrics, batch]
173+
exporters: [otlphttp/metrics]
174+
133175
logs:
134176
receivers: [filelog]
135-
processors: [resource, transform, batch]
136-
exporters: [otlphttp, debug]
177+
processors: [resource, transform/logs, batch]
178+
exporters: [otlphttp/logs, debug]
137179

138180
extensions: []
139181

0 commit comments

Comments
 (0)