How to Ignore context.Canceled
Error
#5703
Labels
area:trace
Part of OpenTelemetry tracing
enhancement
New feature or request
pkg:SDK
Related to an SDK package
I have a service that uses context cancelation by design to stop any previous process if the other/newest one is coming. The way I make a span is exactly similar to the any example from the instrumentation such as below
Mostly, the span starts from the http server wrapper, and then it produces children span from the http client wrapper, grpc client wrapper, or sql client wrapper ( I didn't manually start/end any parent/children span)
My problem is when it comes to my instrumentation such as
otelhttp
,otelgrpc
,otelsql
, etc. The instrumentation always produces a span with theotel.status: 'ERROR'
and it leads to an increased error rate.Is there any way to replace/modify any field by configuring the tracer/trace provider/span processor or anything on a specific service? I don't want to add any changes to the collector, because it is only an exception in one of my services.
I've found a possible way of using the
SpanProcessor
, the idea is I could use theOnEnd
func to filter thecontext.Canceled
error. But, there's an issue because theOnEnd
function only receive theReadOnlySpan
. What I want to do is to get rid of theotel.status: 'ERROR'
field, not to drop the entire span. Are there any ideas to solve my usecase?opentelemetry-go/sdk/trace/span_processor.go
Lines 15 to 50 in b5a9cfb
The text was updated successfully, but these errors were encountered: