opentelemetry-dotnet-contrib
opentelemetry-dotnet-contrib copied to clipboard
AspNetCore instrumentation: filter out parent span but allow children
Question
When I configure the AspNetCoreInstrumentationOptions.Filter delegate, if it returns false AspNetCore instrumentation won't create a span and will prevent the creation of any spans within the scope of this request. Is it possible to skip the AspNetCore span but allow child spans?
For example, when I have AspNetCore and QraphQL instrumentations enabled, I want the QraphQL instrumentation to filter out queries with the operation name IntrospectionQuery, so I configure it this way. But the AspNetCore instrumentation still creates the span with the /graphql path, which I want to discard.
The question can also be rephrased this way: Can the child span discard the parent span?
Have you considered using AlwaysOnSampler()? --> This will not prevent creation of child activities. The root one can still be filtered out using Filter delegate.
Hey @vishweshbankwar, sorry for the late response. I do want to have a sampling configuration, so AlwaysOnSampler doesn't fit my needs.