# 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** MUST be of the format ` ` provided that `graphql.operation.type` and `graphql.operation.name` are available. If `graphql.operation.name` is not available, the span SHOULD be named ``. When `` is not available, `GraphQL Operation` MAY be used as span name. | 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` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`graphql.operation.name`](/docs/attributes-registry/graphql.md) | string | The name of the operation being executed. | `findBookById` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | [`graphql.operation.type`](/docs/attributes-registry/graphql.md) | string | The type of the operation being executed. | `query`; `mutation`; `subscription` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | **[1]:** 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 | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `query` | GraphQL query | ![Experimental](https://img.shields.io/badge/-experimental-blue) | | `subscription` | GraphQL subscription | ![Experimental](https://img.shields.io/badge/-experimental-blue) | [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status