open-telemetryotel

Opentelemetry override or ignore client span error status


Using Opentelemetry, I am generating spans in a trace, and I have an external library that does a HTTP GET call (to Elasticsearch). This span is marked as "client" and it is marked as "error" by the OTEL java agent that we are using. The library catches the exception and ignores it on certain http status codes, which we cannot control.
Is there something that can be done either to override that client error span status (with sdk or api) or to configure the agent so that it ignores these kind of span errors?

enter image description here


Solution

  • As Martin suggested, we ended up writing a processor in the OTel collector to ignore the span in this unwanted(by us) situation. There are quite a few processors available to choose from https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor