Skip to content

GraphQLOperationTrace is never created, resulting in partial instrumentation #1437

@Doctor-God

Description

@Doctor-God

Description

When any graphql query is executed, the following warning appears on the agent logs:
newrelic.hooks.framework_graphql WARNING - Runtime instrumentation warning. GraphQL operation found without active GraphQLOperationTrace.
What ends up happening is the graphql requests are not properly identified and don't have any of the expected fields, like operation_name.

Expected Behavior

GraphQL calls should be correctly instrumented.

Troubleshooting

newrelic.hooks.framework_graphql WARNING - Runtime instrumentation warning. GraphQL operation found without active GraphQLOperationTrace.

Steps to Reproduce

I tried auto instrumentation both with the "newrelic-admin run-program" and by wrapping my wsgi application, as per docs.
I monkey-patched both the hook framework_graphql and graphql-core and noticed while wrap_graphql_impl (the wrapper that creates the GraphQLOperationTrace) was applied through instrument_graphql, it is never called. graphql-core's graphql_impl is also never called when executing a query or mutation.
The trace that is found on wrap_execute_operation and results in the aforementioned warning is a FunctionTrace.
I wonder if the auto-instrumentation is wrapping the wrong function?

Your Environment

Python 3.12.5
Agent 10.15.0
django 5.2.4
graphql-core 3.2.6
graphene 3.4.3
graphene-django 3.2.3
gunicorn 23.0.0

We have somewhat of a legacy system which recently migrated to Graphene 3. We might have some custom overrides on the standard lib required to maintain our API backwards-compatible, but none of them seem to be related to the mentioned functions.

Additional context

I tried search for others with a similar problems and found the following support threads:
https://support.newrelic.com/s/hubtopic/aAXPh0000001lcnOAA/graphqloperationtrace-in-logs
https://support.newrelic.com/s/hubtopic/aAX8W0000008cXLWAY/python-warnings-regarding-graphql-trace
The latter seems to be the same problem, but the solution provided was simply to silence the warning logs, which is not what I'm looking for.

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new or enhanced features.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions