Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ OTEL_JAVA_AGENT_VERSION=2.23.0
OPENTELEMETRY_CPP_VERSION=1.24.0

# Dependent images
COLLECTOR_CONTRIB_IMAGE=ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.142.0
COLLECTOR_CONTRIB_IMAGE=ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.144.0
FLAGD_IMAGE=ghcr.io/open-feature/flagd:v0.12.9
GRAFANA_IMAGE=grafana/grafana:12.3.1
JAEGERTRACING_IMAGE=jaegertracing/jaeger:2.12.0
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ the release.

* [accounting] fix memory leak with dbcontext
([#2876](https://github.com/open-telemetry/opentelemetry-demo/pull/2876))
* [chore] Bump OTel Collector to v0.144.0 and rename OTLP exporters
`otlp`--> `otlp_grpc` and `otlphttp` --> `otlp_http`
[#2942](https://github.com/open-telemetry/opentelemetry-demo/pull/2942)
* [collector] Use the
[`set_semconv_span_name()`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor#set_semconv_span_name)
function to better handle the next.js issue
[High-cardinality HTTP span names #54694](https://github.com/vercel/next.js/issues/54694)
[#2942](https://github.com/open-telemetry/opentelemetry-demo/pull/2942)

## 2.2.0

Expand Down
55 changes: 46 additions & 9 deletions src/otel-collector/otelcol-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ receivers:
enabled: true
exporters:
debug:
otlp:
otlp_grpc/jaeger:
Comment thread
julianocosta89 marked this conversation as resolved.
endpoint: "jaeger:4317"
tls:
insecure: true
sending_queue:
batch:
otlphttp/prometheus:
otlp_http/prometheus:
endpoint: "http://prometheus:9090/api/v1/otlp"
tls:
insecure: true
Expand All @@ -152,14 +152,51 @@ processors:
spike_limit_percentage: 25
resourcedetection:
detectors: [env, docker, system]
transform:
transform/sanitize_spans:
error_mode: ignore
trace_statements:
- context: span
statements:
# could be removed when https://github.com/vercel/next.js/pull/64852 is fixed upstream
- replace_pattern(name, "\\?.*", "")
- replace_match(name, "GET /api/products/*", "GET /api/products/{productId}")
# Sanitize spans to prevent span metrics cardinality explosion
# caused by non-compliant high cardinality span names:
# 1. Define missing http.route on key HTTP operations for meaningful operation names
# 2. Then normalize span names; http server spans lacking http.route default to operations "GET", "POST", etc.

# FRONTEND SERVICE

# Workaround for Next.js high cardinality span name issue: https://github.com/vercel/next.js/issues/54694
- set(span.attributes["http.route"], "/api/cart") where
span.kind == SPAN_KIND_SERVER and
resource.attributes["service.name"] == "frontend" and
span.attributes["http.route"] == nil and
IsMatch(span.attributes["http.target"], "\\/api\\/cart") # e.g. # /api/cart

- set(span.attributes["http.route"], "/api/checkout") where
span.kind == SPAN_KIND_SERVER and
resource.attributes["service.name"] == "frontend" and
span.attributes["http.route"] == nil and
IsMatch(span.attributes["http.target"], "\\/api\\/checkout") # e.g. # /api/checkout

- set(span.attributes["http.route"], "/api/products/{productId}") where
span.kind == SPAN_KIND_SERVER and
resource.attributes["service.name"] == "frontend" and
span.attributes["http.route"] == nil and
IsMatch(span.attributes["http.target"], "\\/api\\/products\\/.*") # e.g. /api/products/1YMWWN1N4O

- set(span.attributes["http.route"], "/api/recommendations") where
span.kind == SPAN_KIND_SERVER and
resource.attributes["service.name"] == "frontend" and
span.attributes["http.route"] == nil and
IsMatch(span.attributes["http.target"], "\\/api\\/recommendations") # e.g. # /api/recommendations?productIds=...

- set(span.attributes["http.route"], "/api/data") where
span.kind == SPAN_KIND_SERVER and
resource.attributes["service.name"] == "frontend" and
span.attributes["http.route"] == nil and
IsMatch(span.attributes["http.target"], "\\/api\\/data.*") # e.g. # " /api/data?contextKeys=telescopes" or /api/data/?contextKeys=cameras

# SANITIZE ALL SPAN NAMES TO PREVENT CARDINALITY EXPLOSION
- set_semconv_span_name("1.37.0", "original_span_name")
Comment thread
julianocosta89 marked this conversation as resolved.

connectors:
spanmetrics:
Expand All @@ -168,12 +205,12 @@ service:
pipelines:
traces:
receivers: [otlp]
processors: [resourcedetection, memory_limiter, transform]
exporters: [otlp, debug, spanmetrics]
processors: [resourcedetection, memory_limiter, transform/sanitize_spans]
exporters: [otlp_grpc/jaeger, debug, spanmetrics]
metrics:
receivers: [docker_stats, httpcheck/frontend-proxy, hostmetrics, nginx, otlp, postgresql, redis, spanmetrics]
processors: [resourcedetection, memory_limiter]
exporters: [otlphttp/prometheus, debug]
exporters: [otlp_http/prometheus, debug]
logs:
receivers: [otlp]
processors: [resourcedetection, memory_limiter]
Expand Down