Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] GQLgen Tracer - Introspection query is not always being filtered #3085

Open
khwong-altium opened this issue Jan 14, 2025 · 1 comment
Assignees
Labels
bug unintended behavior that has to be fixed

Comments

@khwong-altium
Copy link

We are using GQL Tracer for our application.
We want to reduce the amount of noise so have enabled the WithoutTraceIntrospectionQuery Option.

However, the tracer sometimes collects fields under the Introspection query.
We have confirm:

  • Playground comes with github.com/99designs/gqlgen: Filtered properly
  • Retool introspection (https://www.retool.com) : Does not filtered

We have configured the tracer as follow:

func createGQLHandler(	schema graphql.ExecutableSchema) http.Handler {
	h := handler.New(schema)
	h.AddTransport(transport.Options{})
	h.AddTransport(transport.POST{})
	h.Use(extension.Introspection{})
	h.SetRecoverFunc(func(ctx context.Context, err interface{}) error {
		logger.Error("graphql panic", "err", err)
		debug.PrintStack()
		return gqlerror.Errorf("internal system error")
	})
	h.SetErrorPresenter(func(ctx context.Context, err error) *gqlerror.Error {
		logger.Error("graphql error", "err", err)
		return graphql.DefaultErrorPresenter(ctx, err)
	})
	if config.DD_TRACE_ENABLED {
		t := gqlgentrace.NewTracer(
			gqlgentrace.WithAnalytics(true),
			gqlgentrace.WithServiceName(logging.DDServiceName),
			gqlgentrace.WithoutTraceIntrospectionQuery(),
			gqlgentrace.WithoutTraceTrivialResolvedFields(),
		)
		h.Use(t)
	}
	httpAuthware, gqlAuthware := authenticator.NewAuthMiddleware(skipAudCheck)
	h.AroundOperations(gqlAuthware)
	return httpAuthware(h)
}

Version of dd-trace-go
1.70.3

Describe what happened:
Query comes from Retool traced all the fields under it.

Image

Describe what you expected:

  • All fields under any query operation named IntrospectionQuery shall not be traced.

Steps to reproduce the issue:

  • Login Retool
  • Connecting any resource with above tracer.
  • Creating a query to the GQL resource and trigger the Introspection Query.

Additional environment details (Version of Go, Operating System, etc.):

@khwong-altium khwong-altium added the bug unintended behavior that has to be fixed label Jan 14, 2025
@github-actions github-actions bot added the needs-triage New issues that have not yet been triaged label Jan 14, 2025
@darccio darccio removed the needs-triage New issues that have not yet been triaged label Jan 20, 2025
@mtoffl01
Copy link
Contributor

mtoffl01 commented Feb 4, 2025

Hello @khwong-altium ,

Thanks for opening this issue. We are looking into it and will follow up once we have more information. In the meantime, if you would like to contribute, we'll be glad to review and merge your contribution!

In case this is time sensitive for you, please reach out to Datadog Support so we can best prioritize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unintended behavior that has to be fixed
Projects
None yet
Development

No branches or pull requests

4 participants