Skip to content
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

Add graphql integration option to automatically rename root spans based on graphql.operation.name #13238

Closed
andreiborza opened this issue Aug 5, 2024 · 0 comments · Fixed by #13248
Assignees

Comments

@andreiborza
Copy link
Member

Description

Root spans are currently named by otel and are cumbersome to retroactively change to a more meaningful name. See #12887 (comment).

Brainstorm
Add an option akin to inferRootSpanNameFromGraphQLOperation: boolean (naming TBD) to our GraphQL instrumentation to update the name of the root span to that of the (last) child span that has a graphql.operation.name set.

@mydea mydea self-assigned this Aug 6, 2024
mydea added a commit that referenced this issue Aug 8, 2024
…13248)

This introduces a new option for the `graphqlIntegration`,
`useOperationNameForRootSpan`, which is by default `true` but can be
disabled in integration settings like this: `Sentry.graphqlIntegration({
useOperationNameForRootSpan: true })`.

With this setting enabled, the graphql instrumentation will update the
`http.server` root span it is in (if there is one) will be appended to
the span name. So instead of having all root spans be `POST /graphql`,
the names will now be e.g. `POST /graphql (query MyQuery)`.

If there are multiple operations in a single http request, they will be
appended like `POST /graphql (query Query1, query Query2)`, up to a
limit of 5, at which point they will be appended as `+2` or similar.

Closes #13238
This issue was closed.
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 a pull request may close this issue.

2 participants