-
Notifications
You must be signed in to change notification settings - Fork 551
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
I cannot make GraphQLInstrumentation produce spans #1456
Comments
Is it ensured that above OTel init code is executed before graphql is required? |
Initializing the OTel things is the first thing done in the index.ts file. Here is the first few lines in my index.ts file (removed some imports that seems completely irrelevant):
|
I am using esbuild. Could it be a similar issue as this one? open-telemetry/opentelemetry-js#2786 I might say that I am not deeply familiar with node/js/typescript/esbuild, so there might be something that is obvious to some, that completely goes over my head |
I'm also not familiar with esbuild and how the result looks like. bundlers tend to break Otel instrumentations. Reason is that instrumentations "listen" to As far as I remember at least webpack has an option to exclude specific modules to be included into the bundle. |
I excluded graphql and that worked, thanks a lot! |
I'm facing the same issue, also with Webpack and TypeScript. Can anyone provide an example of how to configure? It would also be great if the documentation was updated. The README claims this instrumentation is automatic, but it clearly is not as automatic as other instrumentations. |
I agree that it would be nice to have in the readme file. I was using esbuild, but what I had to do is to exclude graphql when building the index.js file: Also, since the graphql-libraries are now not built into the index-file, I had to add a postbuild script that copies the needed graphql-library-files in the folder into my build folder (the folder where the resulting index.js is put) |
yes, bundlers like webpack break instrumentations. I'm not an expert of these so can't provide a guideline how to avoid that these tools break OTel. Could you create a PR to add the limitations you faced and solutions you found into the Otel docs? |
Did you find a solution? I am currently facing the same, excluding |
Maybe try to not use any bundler and not use ESM modules (import) (refs: open-telemetry/opentelemetry-js#3698). Also important is to register instrumentations before the instrumented modules are required. |
Rewriting the app is a non-starter for us. |
I didn't mean you should rewrite all your apps. My statement was intended to give some hints how to analyze this further and to get a solution step by step. I don't know your app nor I'm an bundler expert. Support for bundlers (either document how to use them or improve the instrumentation libs itself) requires help from people using and understanding them. |
What version of OpenTelemetry are you using?
What version of Node are you using?
16.16.0
What did you do?
I have an apollo server application written in typescript, using apollo server v.4.3.0. I have tried to register my instrumentation in the following way:
After I run my service I make a request to a mutation.
What did you expect to see?
I expect to see any traces (/spans?) in the console logs that mentions anything graphql-related. Some information about resolvers and such.
What did you see instead?
As for graphql spans, complete silence. I only see traces in the console log describing grpc- and http-requests that are made by the data sources. For example (among others):
{ traceId: 'f0f566152aa900573e30fdc8bb9ccf5e', parentId: '0bba32f6f1a44054', traceState: undefined, name: 'some.grpc.namespace.SomeMethod', id: '90dbfc2a9b0f9160', kind: 2, timestamp: 1680614886317000, duration: 309645, attributes: { 'rpc.system': 'grpc', 'rpc.method': 'SomeMethod', 'rpc.service': 'some.grpc.namespace.SomeMethod', 'net.peer.name': 'localhost', 'net.peer.port': 9408, 'rpc.grpc.status_code': 0 }, status: { code: 0 }, events: [], links: [] }
Additional context
The documentation says that supportet versions are: >=14 <16. Im not sure supported versions of what.
I have also tried to downgrade the graphql version from 16.to 15.7.2.
The text was updated successfully, but these errors were encountered: