@opentelemetry/instrumentation-graphql
increases event loop latency by ~10x
#1739
Labels
bug
Something isn't working
pkg:instrumentation-graphql
priority:p1
Bugs which cause problems in end-user applications such as crashes, data inconsistencies
What version of OpenTelemetry are you using?
1.17.0
What version of Node are you using?
17.9.1
What did you do?
Installed
@opentelemetry/instrumentation-graphql
with default options anddepth: 0
.What did you expect to see?
Minimal impact to latency.
What did you see instead?
While debugging a graphql query using ApolloServer which returns 340KB of data (11,494 keys in the response JSON) I noticed that our business logic was executing just under 50ms while the request was taking ~1.2s. Using the tracing data collected by
@opentelemetry/instrumentation-graphql
I was able to observe that all of our resolvers took ~86ms CPU time but 1.1s wall time. I suspected something was wrong with resolver scheduling so ranclinic doctor -- node server.ts
to gain insight and noticed during the span of the query, the event loop experienced ~250ms of latency. Removing@opentelemetry/instrumentation-graphql
decreased this down to ~20ms of latency and reduced the overall request timing to 187ms.TL;DR even with
depth: 0
, for large payloads@opentelemetry/instrumentation-graphql
increased event loop latency by an order of magnitude.Replication details
While replication of our exact problem would require our server code, a minimal example of problematic and large GraphQL payloads can be found here to test with: https://codesandbox.io/s/apollo-server-performance-issue-i7fk7
The text was updated successfully, but these errors were encountered: