I'm struggling to figure out a way to add tracing to gqlgen. Based on the example found here, handler.Graphql is being used but in all recent examples the api is different.
Here's my implementation:
In my handler file
srv := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{
Resolvers: &Resolver{
Store: store,
},
}))
return srv
In my api file
srv := graph.NewGraphqlHandler(store, logger)
// modelgen.Middleware is for including dataloaders. This also doesn't seem very clean.
r.Handle("/", graph.NewPlaygroundHandler("/query"))
r.Handle("/query", modelgen.Middleware(store, srv))
Based on digging, I found this issues that might be related: https://github.com/99designs/gqlgen-contrib/issues/19 @vvakame
sorry for late response. I'll be doing something...
@miamollie https://github.com/99designs/gqlgen/blob/master/graphql/handler/apollotracing/tracer_test.go#L33-L35
Here is the new API for apollotracing.
I think you can use it simple add srv.Use(apollotracing.Tracer{}).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Nope, stale.
I've added this line to my code srv.Use(apollotracing.Tracer{}), but then this is what I see when I call the API:

An extensions section showed up on the response, but no content on it. What am I missing? (BTW I did tried it with a more complex graphql query, I just simplified it for the screenshot)
@pablote you may need to activate tracing in GraphiQL, on the bottom right.