-
Notifications
You must be signed in to change notification settings - Fork 538
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
instrumentation-graphql doesn't work with apollo-server-express and federated schema #375
Comments
Mixing API/Core 0.18.0 with {{@opentelemetry/instrumentation-graphql}} 0.13.1 wont work. See compatibility-matrix. The instrumentations/plugins here have been updated to use 0.18.0 just recently (see #371) but there was no release made yet. OTel API is close to go GA and therefore quite a lot is moving. I assume the modules hosted here are published soon. |
Hello @Flarna Thanks for the fast reply, was not aware of the compatibility-matrix Yesterday I was running the I Will try to run my own example with v0.15.0 tho to see whether there will be some change regarding Kind Regards, |
Hello @Flarna Tested with OTel v0.15.0, the same outcome... no graphql traces were generated |
Hello @bokjo What happens when you move the |
Hello @weyert Sorry I forgot to comment and close the issue yesterday evening (after few hours of debugging, at least now I know a bit more about the plugins and APIs from OTel ) Yes that was the reason, I had to import and initialize the tracing first at the top of the main import { initializeTracing } from "./tracing";
import { logger } from "./logger";
const { gqlTracer, provider } = initializeTracing(logger);
...
// Rest of the imports and code I understand the chicken and egg thing the hard way with a hint from
My bad, I know that all the examples start with require a tracer as a first thing but it didn't cross my mind yesterday... 'use strict';
require('./tracer')('example-express-server'); Don't know if I missed some how to quick start guide but the issue is solved now :) I Will try to test it today with v0.17.0 and/or v0.18.0 p.s Should I comment and close the issue myself? |
@bokjo if all is fine for you please comment and close the issue so that we know it is no longer an issue, thank you |
Issue resolved by importing and initializing the tracing lib. at the top of the main file. |
What version of OpenTelemetry are you using?
0.18.0 and 0.17.0?!?
Part of package.json
What version of Node are you using?
v14.15.4 (npm v6.14.10)
What did you do?
If possible, provide a recipe for reproducing the error.
Implement tracing with
instrumentation-graphql
in order to trace GraphQL resolvers running on Apollo Server with generated federated schematracing.ts
What did you expect to see?
Expected to see the tracing spans (graphql.execute, graphql.resolver...) as in the graphql example here: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/graphql
This is an image I took running the example above
What did you see instead?
Nothing is happening with all the plugins (express, http...) set to
false
, no traces are generated and pushed to the exporter of choice...If I explicitly enable the plugins
@opentelemetry/plugin-http/s
intracer.ts
registerInstrumentations... then I see only the autogenerated HTTP traces with name "HTTP POST" for/graphql
...(p.s my resolver is using Firebase Auth and I see the HTTP calls that are made to Google Identity Provider... not really useful for now since I need the resolver info and query to understand better the GraphQL flow...)
Additional context
Source code:
main.ts
Add any other context about the problem here.
buildFederatedSchema()
returns a propperGraphQLSchema
object type!Also tried the same setup for the GraphQL server with vanilla
apollo-server
andexpress-graphql
, and the outcome is the same...Calling the GraphQL endpoint directly or through Apollo Federation Gateway yields the same result!
I'm willing to help in any shape and form just will need some guidance in how to properly debug and understand what the
instrumentation-qraphql
is actually doing under the hood...The text was updated successfully, but these errors were encountered: