Skip to content

Commit

Permalink
Remove query params and product ID from span names (open-telemetry#1668)
Browse files Browse the repository at this point in the history
* Fixes open-telemetry#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 <julianocosta89@outlook.com>
  • Loading branch information
2 people authored and ahealy-newr committed Jul 24, 2024
1 parent c3e8e60 commit 307dbd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/otelcollector/otelcol-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]
Expand Down

0 comments on commit 307dbd6

Please sign in to comment.