Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.144.0
COLLECTOR_CONTRIB_IMAGE=ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.145.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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ the release.

* [accounting] fix memory leak with dbcontext
([#2876](https://github.com/open-telemetry/opentelemetry-demo/pull/2876))
* [chore] Upgrade OTel Collector to v0.145.0 with :warning: breaking change:
OTLP exporters renamed from `otlp` to `otlp_grpc/jaeger` and from
`otlphttp/prometheus` to `otlp_http/prometheus`
[#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
51 changes: 44 additions & 7 deletions src/otel-collector/otelcol-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ receivers:
enabled: true
exporters:
debug:
otlp_grpc:
otlp_grpc/jaeger:
Comment thread
julianocosta89 marked this conversation as resolved.
endpoint: "jaeger:4317"
tls:
insecure: true
Expand Down Expand Up @@ -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,8 +205,8 @@ service:
pipelines:
traces:
receivers: [otlp]
processors: [resourcedetection, memory_limiter, transform]
exporters: [otlp_grpc, 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]
Expand Down