54 lines
2.8 KiB
Markdown
54 lines
2.8 KiB
Markdown
<!--- Hugo front matter used to generate the website version of this page:
|
|
linkTitle: GraphQL Server
|
|
--->
|
|
|
|
# Semantic Conventions for GraphQL Server
|
|
|
|
**Status**: [Experimental][DocumentStatus]
|
|
|
|
This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map GraphQL
|
|
operations to attributes on a Span.
|
|
|
|
The **span name** SHOULD be of the format `{graphql.operation.type}` provided
|
|
`graphql.operation.type` is available. If `graphql.operation.type` is not available,
|
|
the span SHOULD be named `GraphQL Operation`.
|
|
|
|
> **Warning**
|
|
> The `graphql.operation.name` value is provided by the client and can have high
|
|
> cardinality. Using it in the GraphQL server span name (by default) is
|
|
> NOT RECOMMENDED.
|
|
>
|
|
> Instrumentation MAY provide a configuration option to enable a more descriptive
|
|
> span name following `{graphql.operation.type} {graphql.operation.name}` format
|
|
> when `graphql.operation.name` is available.
|
|
|
|
<!-- semconv span.graphql.server -->
|
|
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
|
|
<!-- see templates/registry/markdown/snippet.md.j2 -->
|
|
<!-- prettier-ignore-start -->
|
|
<!-- markdownlint-capture -->
|
|
<!-- markdownlint-disable -->
|
|
|
|
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|
|
|---|---|---|---|---|---|
|
|
| [`graphql.document`](/docs/attributes-registry/graphql.md) | string | The GraphQL document being executed. [1] | `query findBookById { bookById(id: ?) { name } }` | `Recommended` |  |
|
|
| [`graphql.operation.name`](/docs/attributes-registry/graphql.md) | string | The name of the operation being executed. | `findBookById` | `Recommended` |  |
|
|
| [`graphql.operation.type`](/docs/attributes-registry/graphql.md) | string | The type of the operation being executed. | `query`; `mutation`; `subscription` | `Recommended` |  |
|
|
|
|
**[1] `graphql.document`:** The value may be sanitized to exclude sensitive information.
|
|
|
|
`graphql.operation.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
|
|
|
|
| Value | Description | Stability |
|
|
|---|---|---|
|
|
| `mutation` | GraphQL mutation |  |
|
|
| `query` | GraphQL query |  |
|
|
| `subscription` | GraphQL subscription |  |
|
|
|
|
<!-- markdownlint-restore -->
|
|
<!-- prettier-ignore-end -->
|
|
<!-- END AUTOGENERATED TEXT -->
|
|
<!-- endsemconv -->
|
|
|
|
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
|