Skip to content

Commit 856aaac

Browse files
author
Juan Reyes
committed
fix: add transform processor to include Bedrock user_email in metrics
1 parent 757cfd9 commit 856aaac

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

otel-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ processors:
2020
limit_mib: 512
2121
spike_limit_mib: 128
2222

23+
# Add resource attributes to metrics for Bedrock users
24+
# Only adds if not already present (avoids duplicates)
25+
transform:
26+
metric_statements:
27+
- context: datapoint
28+
statements:
29+
- set(attributes["provider"], resource.attributes["provider"]) where attributes["provider"] == nil and resource.attributes["provider"] != nil
30+
- set(attributes["team"], resource.attributes["team"]) where attributes["team"] == nil and resource.attributes["team"] != nil
31+
- set(attributes["user_email"], resource.attributes["user_email"]) where attributes["user_email"] == nil and resource.attributes["user_email"] != nil
32+
2333
exporters:
2434
prometheus:
2535
endpoint: "0.0.0.0:8889"
@@ -48,7 +58,7 @@ service:
4858
pipelines:
4959
metrics:
5060
receivers: [otlp]
51-
processors: [memory_limiter, batch]
61+
processors: [memory_limiter, transform, batch]
5262
exporters: [prometheus, debug]
5363

5464
logs:

0 commit comments

Comments
 (0)