Open chazapp opened 1 month ago
The span name could be formed using a pattern that would be user provided from API configuration.
I think we should definitely go with this options since any of the others will mean a breaking change for existing users.
Describe the problem
The Tyk Gateway OpenTelemetry implementation generates high cardinality span names, from this line of code: https://github.com/TykTechnologies/opentelemetry/blob/545b95987720821156bf3f0547fb02b9ee063a57/trace/handler.go#L55-L57
This code can create span names containing URI data with high cardinality, such as:
OpenTelemetry's Semantic Conventions for HTTP Spans clearly states:
Describe the solution you'd like
The issue can be solved in different ways. Here are a few ideas:
Change the span name to `{method}`
Per OpenTelemetry convention, if finding a low-cardinality target is not possible, set the span name to the HTTP method only.Change the span name to `{method} {apiName}`
Either via context or parsing, use only the downstream API name.Allow a pattern to be passed via config
The span name could be formed using a pattern that would be user provided from API configuration.Describe alternatives you've considered
I can use OTEL-Collector transform processor to edit spans before they reach my storage backend, but I'd rather see the issue fixed upstream, in the span creator, respecting Open Telemetry conventions.