Skip to content

feat(attributes): Add graphql.processing.type - #572

Merged
andreiborza merged 2 commits into
mainfrom
ab/graphql-processing-type
Aug 25, 2026
Merged

andreiborza merged 2 commits into
mainfrom
ab/graphql-processing-type

Conversation

@andreiborza

@andreiborza andreiborza commented Aug 24, 2026

Copy link
Copy Markdown
Member

Description

Adds graphql.processing.type, which says which part of GraphQL request processing a span represents: parse, validate, execute, resolve and so on. Adds it to the graphql span name templates as well, so the phases get a name of their own:

GraphQL {{graphql.operation.type}}
GraphQL {{graphql.processing.type}}
GraphQL Operation

GraphQL span names are low cardinality and carry the operation type at most, so a parse span and a validate span are otherwise indistinguishable. A parse span carries no GraphQL attribute at all today.

Both attributes are set on an operation span, and only graphql.processing.type on the phases, so the template order keeps GraphQL query for operations and gives GraphQL parse / GraphQL validate / GraphQL resolve to the rest.

Also replaces the mutation and query examples, which no template can produce since Sentry prefixes GraphQL span names with GraphQL , as the otel_notes on the same entry says. They predate that prefix.

The attribute name and its value list follow the GraphQL OpenTelemetry Working Group proposal in open-telemetry/semantic-conventions#3515. That PR is still a working draft, so is_in_otel is false for now and should be flipped once it lands upstream. Note that the working group deliberately did not widen graphql.operation.type for this, since that attribute holds the GraphQL operation type (query, mutation, subscription) and applies only to spans that run an operation.

@sentry/javascript wants this for getsentry/sentry-javascript#23542, where streamed GraphQL spans lose the operation name and the resolver field path from their names.

PR Checklist

  • I have run yarn test and verified that the tests pass.
  • I have run yarn generate to generate and format code and docs.

If an attribute was added:

  • The attribute is in a namespace (e.g. nextjs.function_id, not function_id)
  • I have used the correct value for apply_scrubbing (i.e. manual or auto. Use never only for values that should never be scrubbed such as IDs)

@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (attributes) Add graphql.processing.type by andreiborza in #572

Bug Fixes 🐛

  • (names) Correct graphql span name examples by andreiborza in #573

🤖 This preview updates automatically when you update the PR.

andreiborza and others added 2 commits August 25, 2026 13:34
Identifies which part of GraphQL request processing a span represents
(parse, validate, execute, resolve and so on), so consumers do not have
to read it out of the span name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013bjBXkGkJo8eL8hkz48byi
Also replaces the `mutation`/`query` examples, which no template can
produce since Sentry prefixes GraphQL span names with `GraphQL `.

Claude-Session: https://claude.ai/code/session_013bjBXkGkJo8eL8hkz48byi
@andreiborza
andreiborza force-pushed the ab/graphql-processing-type branch from d87ac93 to 1cdfe40 Compare August 25, 2026 11:35
@andreiborza
andreiborza requested a review from Lms24 August 25, 2026 11:42

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

attribute and name changes look good to me. IMHO these are all low-cardinality and the processing types were previously missing and would have caused us to fall back to the static string. So having this new rule should be fine.

@andreiborza
andreiborza merged commit db559ed into main Aug 25, 2026
19 checks passed
@andreiborza
andreiborza deleted the ab/graphql-processing-type branch August 25, 2026 11:45
andreiborza added a commit to getsentry/sentry-javascript that referenced this pull request Aug 25, 2026
## What

With span streaming enabled, graphql spans are now named after the
operation type (`GraphQL query`), or after the processing type where
there is none (`GraphQL parse`, `GraphQL resolve`), instead of after the
client-supplied operation name or resolver field path.
`useOperationNameForRootSpan` also no longer renames the enclosing root
span. Every graphql span now carries `graphql.processing.type`, which
says whether it is a parse, validate, execute or resolve span.

## Why

Span names must be low cardinality when span streaming is enabled, and
the operation name and field path both come from the client. A
low-cardinality name cannot also say which part of request processing a
span covers, so `graphql.processing.type` carries that instead,
following the GraphQL OpenTelemetry Working Group proposal in
open-telemetry/semantic-conventions#3515. Blocked on
getsentry/sentry-conventions#572, which defines the attribute; the key
is inlined until that ships.

Closes: #23526

https://claude.ai/code/session_013bjBXkGkJo8eL8hkz48byi

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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