Is your feature request related to a problem? Please describe.
Currently, in io.opentelemetry.instrumentation.graphql.internal.OpenTelemetryInstrumentationHelper#beginExecuteOperation, there is this line of code state.setQuery(AstPrinter.printAst(node)); which prints the GraphQL document as a span attribute.
During rollout of instrumentation for a service, we encountered cases where we suspected this was causing a performance degradation for some types of documents. We currently have a naive workaround, but I’d like to propose that it should be possible to disable the dumping of the GraphQL document as an instrumentation configuration.
The numbers I’ve been told for this function call range from 36ms ~ 130ms.
The in-development semantic convention Requirement Level for this attribute is only Recommended.
Describe the solution you'd like
The addition of a new configuration flag otel.instrumentation.graphql.print-query.enabled with default true that applies to both 12.0 and 20.0. This can be passed to the point of usage the same way as the existing sanitizeQuery flag.
Describe alternatives you've considered
It doesn’t seem that an alternative exists, but I’m open to suggestions.
It seems to me that not printing the document can be desirable for reasons other than performance also - for example removing undesired large bytes from span size.
Additional context
N/A
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Is your feature request related to a problem? Please describe.
Currently, in
io.opentelemetry.instrumentation.graphql.internal.OpenTelemetryInstrumentationHelper#beginExecuteOperation, there is this line of codestate.setQuery(AstPrinter.printAst(node));which prints the GraphQL document as a span attribute.During rollout of instrumentation for a service, we encountered cases where we suspected this was causing a performance degradation for some types of documents. We currently have a naive workaround, but I’d like to propose that it should be possible to disable the dumping of the GraphQL document as an instrumentation configuration.
The numbers I’ve been told for this function call range from 36ms ~ 130ms.
The in-development semantic convention Requirement Level for this attribute is only Recommended.
Describe the solution you'd like
The addition of a new configuration flag
otel.instrumentation.graphql.print-query.enabledwith defaulttruethat applies to both12.0and20.0. This can be passed to the point of usage the same way as the existingsanitizeQueryflag.Describe alternatives you've considered
It doesn’t seem that an alternative exists, but I’m open to suggestions.
It seems to me that not printing the document can be desirable for reasons other than performance also - for example removing undesired large bytes from span size.
Additional context
N/A
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.