opentelemetry-java
opentelemetry-java copied to clipboard
Filtering span attributes
Is your feature request related to a problem? Please describe.
Our custom build of OTEL Java agent captures more data, to be specific we capture all request and response headers. This ultimately results in data duplication as the OTEL core instrumentation already collects some of that data. We want to use the core instrumentation, but somehow filter duplicated data. The data could be filtered in the collector, however we would like to save network bandwith from the user process to the collector.
Describe the solution you'd like
A pluggable API in the SDK where we could modify span before passing it to the exporter.
Describe alternatives you've considered
Remove duplicated data in the collector, however, if we could remove it directly in the user process it would be better from the network bandwidth perspective.
Additional context None.
Hi @pavolloffay . Can you have an exporter wrapper that updates the SpanData to filter out what you don't want? Or, alternatively, have a SpanProcessor wrapper that does the same thing?
We have some SpanData wrapping options in the opentelemetry-sdk-extension-tracing-incubator
module to help with this, as well.
@pavolloffay last chance to respond or I will close this as not needed at this time.
I'm having this same issue. The SpanProcessor extension is not sufficient since I need to remove or add attributes and events onEnd, but the onEnd method only exposes a ReadableSpan interface.
@FrankSpitulski I recommend doing this in an exporter, rather than trying to do it in a SpanProcessor
. That interface was not designed for mutating spans when they end.