dd-trace-go
dd-trace-go copied to clipboard
Add option to skip Introspection tracing
Thanks for creating this tracer for gqlgen contrib/99designs/gqlgen
.
I find it unnecessary to trace the Introspection Query since it creates a huge amount of spans. Can there be an option to disable the tracing of it? Specifically the field spans
We currently wrap around gqlTracer
and create a new tracer that looks at the OperationName
from gql context and just skips if it is a Introspection
query
func (t *wrapperGQLTracer) InterceptField(ctx context.Context, next graphql.Resolver) (any, error) {
opCtx := graphql.GetOperationContext(ctx)
if opCtx.OperationName == "IntrospectionQuery" {
res, err := next(ctx)
return res, err
}
if t, ok := t.baseTracer.(graphql.FieldInterceptor); ok {
return t.InterceptField(ctx, next)
}
res, err := next(ctx)
return res, err
}
Similar to this https://github.com/DataDog/dd-trace-js/issues/1046
@liamzhang40 We reviewed it, and we wanted to share it's accepted. If you want to contribute, we'll be glad to review and merge your contribution.
@liamzhang40, I assume #2695 covers what you were looking for?
@liamzhang40, I assume #2695 covers what you were looking for?
Yup! and skipping the trivial is icing on the cake
Glad skipping trivial doesn't just apply to our use case! :tada:
👋 This option has been implemented in #2695 and it should be included in v1.66.0
(it is expected to be released in July).