forked from open-telemetry/opentelemetry-specification
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add semantic conventions for GraphQL (open-telemetry#2456)
Add semantic conventions for GraphQL span name and attributes. Related issues open-telemetry#1670
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
groups: | ||
- id: graphql | ||
prefix: graphql | ||
brief: > | ||
This document defines semantic conventions to apply when instrumenting the GraphQL implementation. They map | ||
GraphQL operations to attributes on a Span. | ||
attributes: | ||
- id: operation.name | ||
brief: "The name of the operation being executed." | ||
type: string | ||
examples: 'findBookById' | ||
- id: operation.type | ||
brief: "The type of the operation being executed." | ||
type: | ||
allow_custom_values: false | ||
members: | ||
- id: query | ||
value: "query" | ||
brief: "GraphQL query" | ||
- id: mutation | ||
value: "mutation" | ||
brief: "GraphQL mutation" | ||
- id: subscription | ||
value: "subscription" | ||
brief: "GraphQL subscription" | ||
examples: ['query', 'mutation', 'subscription'] | ||
- id: document | ||
brief: "The GraphQL document being executed." | ||
type: string | ||
note: The value may be sanitized to exclude sensitive information. | ||
examples: 'query findBookById { bookById(id: ?) { name } }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
specification/trace/semantic_conventions/instrumentation/graphql.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Semantic conventions for GraphQL Server | ||
|
||
**Status**: [Experimental](../../../document-status.md) | ||
|
||
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 `<graphql.operation.type> <graphql.operation.name>` provided that | ||
`graphql.operation.type` and `graphql.operation.name` are available. If `graphql.operation.name` is not available, the | ||
span SHOULD be named `<graphql.operation.type>`. When `<graphql.operation.type>` is not available, `GraphQL Operation` | ||
MAY be used as span name. | ||
|
||
<!-- semconv graphql --> | ||
| Attribute | Type | Description | Examples | Requirement Level | | ||
|---|---|---|---|---| | ||
| `graphql.operation.name` | string | The name of the operation being executed. | `findBookById` | Recommended | | ||
| `graphql.operation.type` | string | The type of the operation being executed. | `query`; `mutation`; `subscription` | Recommended | | ||
| `graphql.document` | string | The GraphQL document being executed. [1] | `query findBookById { bookById(id: ?) { name } }` | Recommended | | ||
|
||
**[1]:** The value may be sanitized to exclude sensitive information. | ||
|
||
`graphql.operation.type` MUST be one of the following: | ||
|
||
| Value | Description | | ||
|---|---| | ||
| `query` | GraphQL query | | ||
| `mutation` | GraphQL mutation | | ||
| `subscription` | GraphQL subscription | | ||
<!-- endsemconv --> |