Skip to content

fix: support GraphQL::Query::Partial in graphql instrumentation #1591

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

utay
Copy link

@utay utay commented Jul 11, 2025

I caught this by using the @stream directive with graphql-ruby and got a NPE on query.selected_operation.operation_type.

Since graphql-ruby 2.5.6, GraphQL::Query::Partial was added for running sub-trees of valid queries. The query argument of execute_query might be a GraphQL::Query::Partial in which case we don't have direct access to the operation type and the query string; I thought in this case it would be nice to see the query path

Copy link

linux-foundation-easycla bot commented Jul 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@utay utay force-pushed the graphql-query-partial branch from 1251a67 to ce02bb9 Compare July 11, 2025 12:30
@utay utay force-pushed the graphql-query-partial branch from ce02bb9 to 2e16b4a Compare July 11, 2025 12:32
@arielvalentin
Copy link
Contributor

Cc @rmosolgo

Copy link
Contributor

@rmosolgo rmosolgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just needs some support for versions where Query::Partial isn't defined.

@utay utay force-pushed the graphql-query-partial branch from 43bf42f to d78a028 Compare July 16, 2025 11:29
@arielvalentin
Copy link
Contributor

Part of our expectations for accepting pull requests is adding automated tests that prevent future regressions.

Please add some test coverage for these changes.

https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/CONTRIBUTING.md#write-comprehensive-automated-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants