From 91c7df4342d033bcab4f0f353c3e229a3dc18196 Mon Sep 17 00:00:00 2001 From: Josh Lee Date: Mon, 15 Jul 2024 23:39:33 -0400 Subject: [PATCH] Remove query params and product ID from span names (#1668) * Fixes #1665 Query Params in Span Name - adds a transform processor - adds two rules for transforming span names: - Strip anything after a "?" - Replace productID with a token in "GET /api/products/{productID}" spans * fix lint errors * update changelog --------- Co-authored-by: Juliano Costa --- CHANGELOG.md | 2 ++ src/otelcollector/otelcol-config.yml | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 879c8f699b..9634fef0f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ the release. ## Unreleased +* [otel-col] strip high-cardinality segments of span names + ([#1668](https://github.com/open-telemetry/opentelemetry-demo/pull/1668)) * [tests] run trace based tests concurrently ([#1659](https://github.com/open-telemetry/opentelemetry-demo/pull/1659)) * [accountingservice] increase memory to 120MB diff --git a/src/otelcollector/otelcol-config.yml b/src/otelcollector/otelcol-config.yml index 62b6b481ce..e58de595eb 100644 --- a/src/otelcollector/otelcol-config.yml +++ b/src/otelcollector/otelcol-config.yml @@ -49,6 +49,14 @@ exporters: processors: batch: + transform: + 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}") connectors: spanmetrics: @@ -57,7 +65,7 @@ service: pipelines: traces: receivers: [otlp] - processors: [batch] + processors: [transform, batch] exporters: [otlp, debug, spanmetrics] metrics: receivers: [docker_stats, httpcheck/frontendproxy, otlp, prometheus, redis, spanmetrics]