Skip to content

Adds GraphQL Semantic Convention from Otel Workgroup#3515

Open
PascalSenn wants to merge 11 commits into
open-telemetry:mainfrom
PascalSenn:pse/update-graphql-specification
Open

Adds GraphQL Semantic Convention from Otel Workgroup#3515
PascalSenn wants to merge 11 commits into
open-telemetry:mainfrom
PascalSenn:pse/update-graphql-specification

Conversation

@PascalSenn

@PascalSenn PascalSenn commented Mar 7, 2026

Copy link
Copy Markdown

Important

This is a working draft and is NOT intended to be merged yet. Final approval is still pending from both the OpenTelemetry Semantic Conventions maintainers and the GraphQL OpenTelemetry Working Group. This PR has been opened early to get feedback from the OTel side and be the base for discussion while the specification is being finalized.

Changes

This PR adds comprehensive GraphQL semantic conventions, developed by the GraphQL OpenTelemetry Working Group, to the OpenTelemetry Semantic Conventions repository.

Origin

This specification was developed in the graphql/graphql-wg otel-wg subcommittee over multiple working group sessions. Key contributors and participants include members from the GraphQL and OpenTelemetry communities working together to define instrumentation standards for GraphQL.

The specification intends to supersede the existing minimal GraphQL semantic conventions (previously only a single server span with 3 attributes) with a comprehensive convention covering the full GraphQL request lifecycle.

  • Cardinality-safe by default: graphql.operation.name is opt-in on metrics; graphql.document.hash and graphql.document.id are preferred identifiers
  • Phase-level observability: Separate spans and metrics for parse, validate, execute, and plan phases
  • Federated/advanced server support: Step execution spans, operation planning, and source attributes for distributed GraphQL systems
  • DataLoader support: Dedicated spans for batch operations with cache hit/miss tracking - Combined error+exception events: GraphQL errors caused by exceptions use a single event with both graphql.error.* and exception.* attributes
  • Subscription support: Dedicated subscription event spans and active subscription
    metrics, distinct from request-level tracking

People involved

This work was developed by the GraphQL OpenTelemetry Working Group, a subcommittee of the GraphQL Working Group. Participants include representatives from across the GraphQL ecosystem working on instrumentation standards.

Important

The workgroup meets every third week of the month on thursday Checkout the calendar
In case you want to join add yourself to the agenda over at GraphQL OpenTelemetry Working Group

Merge requirement checklist

  • CONTRIBUTING.md guidelines followed.
  • Change log entry added, according to the guidelines in When to add a changelog entry.
    • If your PR does not need a change log, start the PR title with [chore]
  • Links to the prototypes or existing instrumentations (when adding or changing conventions)

@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown

This PR contains changes to area(s) that do not have an active SIG/project and will be auto-closed:

  • graphql

Such changes may be rejected or put on hold until a new SIG/project is established.

Please refer to the Semantic Convention Areas
document to see the current active SIGs and also to learn how to kick start a new one.

@github-actions github-actions Bot closed this Mar 7, 2026
@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown

This PR contains changes to area(s) that do not have an active SIG/project and will be auto-closed:

  • graphql

Such changes may be rejected or put on hold until a new SIG/project is established.

Please refer to the Semantic Convention Areas
document to see the current active SIGs and also to learn how to kick start a new one.

@PascalSenn

Copy link
Copy Markdown
Author

@trask Can you let me know the process to get this reviewed?

@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown

This PR contains changes to area(s) that do not have an active SIG/project and will be auto-closed:

  • graphql

Such changes may be rejected or put on hold until a new SIG/project is established.

Please refer to the Semantic Convention Areas
document to see the current active SIGs and also to learn how to kick start a new one.

@trask

trask commented Mar 10, 2026

Copy link
Copy Markdown
Member

re-opening for discussion!

@PascalSenn also check out open-telemetry/opentelemetry-specification#4906

there has been quite a bit of progress since we discussed last year about the option of hosting semantic conventions outside of this repository. I think the work is pretty bleeding edge still but may be ready for external usage soon. In the meantime, let's review and discuss the GraphQL semantic conventions here.

@trask trask reopened this Mar 10, 2026
Comment thread docs/graphql/graphql-metrics.md Outdated
Comment thread docs/graphql/graphql-metrics.md Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/registry.yaml Outdated
Comment thread model/graphql/spans.yaml Outdated
Comment thread model/graphql/spans.yaml Outdated
Comment thread docs/graphql/graphql-metrics.md
@github-actions

Copy link
Copy Markdown

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 7 days.

Comment thread model/graphql/spans.yaml
Comment thread model/graphql/events.yaml Outdated
Comment thread model/graphql/events.yaml Outdated
PascalSenn added 2 commits May 2, 2026 18:40
…consistency

- Updated error attributes in events.yaml to clarify the relationship between GraphQL-specific error details and exception information.
- Renamed metrics in metrics.yaml for consistency, changing `active_requests` to `request.active`.
- Revised registry.yaml to enhance attribute descriptions and examples, including the addition of `graphql.document.locations` and renaming selection attributes to field attributes.
- Improved span definitions in spans.yaml to align with updated field naming conventions and clarified requirements for document IDs and hashes.
@PascalSenn

Copy link
Copy Markdown
Author

@thompson-tomo @trask can we reopen this PR?
I think there is only one comment left. I will present this to the TSC next week so hopefully we can get this in soon. (Ideally in the next couple of weeks)

@trask trask reopened this May 2, 2026
Comment thread docs/graphql/graphql-events.md Outdated
Comment thread model/graphql/spans.yaml
Comment thread model/graphql/events.yaml
Comment thread model/graphql/metrics.yaml Outdated
Comment thread model/graphql/events.yaml
Comment thread model/graphql/events.yaml
Comment thread model/graphql/spans.yaml
Comment thread model/graphql/spans.yaml
Comment thread model/graphql/spans.yaml
Comment thread model/graphql/spans.yaml
Comment thread model/graphql/spans.yaml Outdated
Comment thread model/graphql/spans.yaml Outdated
Comment thread model/graphql/spans.yaml Outdated
Comment thread docs/graphql/graphql-events.md

**Span kind** SHOULD be `INTERNAL`.

**Attributes:**

@magicmark magicmark May 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

would it be worth adding a graphql.subscription.event_count or something?

We're adding an option to let folks opt out of recording spans per subscription event. But it would still be useful to see high level rollups of events metrics. (Consider a case where subscriptions are used to implement streaming down individual characters in an LLM-generated response - would be many events/spans!)

@magicmark magicmark May 13, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Further on this topic @PascalSenn has there been any discussion of using LogRecords per subscription event instead?

Comment thread model/graphql/metrics.yaml Outdated
Comment on lines +68 to +70
This metric measures the end-to-end duration of processing a GraphQL
request on the server. It starts when the server begins processing
the GraphQL operation and ends when the response is complete.

@timbotnik timbotnik May 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One thing that could use clarification is around subscriptions. Would we expect this duration to express "the entire duration of a subscription" or "the duration between starting a subscription and the first subscription response"? Probably the answer to this has some implications for other subscription-related measurements.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's probably worth mirroring the http spec.
There were discussions here: open-telemetry/opentelemetry-specification#3520

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@BrynCooke @timbotnik

I would argue that the graphql.server span is currently specified incorrectly. In the case of SSE and WebSockets, the parent span, the HTTP root span, is also open for the entire duration of the subscription operation. If we want to align with HTTP, we should do the same.

This would also clarify the metric, since it would then represent the entire subscription duration. We could also add another span for the "subscribe" part of the subscription, but if we want to mirror the current HTTP behavior, then we should adjust the graphql.server span.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@BrynCooke @timbotnik i alligned thi sin fc15adf

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the updates. I'm good with this conceptually and appreciate the parity with HTTP / SSE / WebSockets. There may be performance implications which @BrynCooke could weigh in on (e.g. long-held memory allocations) but I'd say we should prefer to align with HTTP.

@github-actions

Copy link
Copy Markdown

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 7 days.

@github-actions github-actions Bot added the Stale label May 28, 2026
@github-actions github-actions Bot closed this Jun 4, 2026
@nlamirault

Copy link
Copy Markdown

Any news on this feature ? Tks.

@PascalSenn

Copy link
Copy Markdown
Author

@thompson-tomo can we reopen this - i try to resolve what's open this week

@thompson-tomo

Copy link
Copy Markdown
Contributor

@PascalSenn unfortunately i dont have permissions to. Ping @open-telemetry/specs-semconv-approvers @open-telemetry/specs-semconv-maintainers

@kamphaus kamphaus reopened this Jun 22, 2026
@kamphaus kamphaus removed the Stale label Jun 22, 2026
@kamphaus

Copy link
Copy Markdown
Contributor

Here you go @PascalSenn

@github-actions

Copy link
Copy Markdown

This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 7 days.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 21, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-25 11:59:42 UTC.

  • Waiting on: Author
  • Next steps:
    • Investigate required status check failures.
    • Address or respond to 1 review feedback item:
      • Inline threads: 1
      • For each item, reply to move the discussion forward, e.g. link to the commit that addresses it, explain why no change is needed, or ask a follow-up question.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. If you believe this pull request is incorrectly routed as waiting on the author, comment /dashboard route:reviewers to route it from waiting on the author to waiting on reviewers. If the last refreshed time above predates your latest reply or push, the dashboard hasn't processed it yet.

@PascalSenn

Copy link
Copy Markdown
Author

This is under review from the graphql foudnation side - so not stale

@github-actions github-actions Bot removed the Stale label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

9 participants