diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 42b552f8d0..e61bae637c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -41,6 +41,7 @@ body: - area:file - area:gcp-cloud-run - area:gcp-gce + - area:graphql - area:host - area:http - area:k8s diff --git a/.github/ISSUE_TEMPLATE/change_proposal.yaml b/.github/ISSUE_TEMPLATE/change_proposal.yaml index f44b30f260..0ae9a6fb32 100644 --- a/.github/ISSUE_TEMPLATE/change_proposal.yaml +++ b/.github/ISSUE_TEMPLATE/change_proposal.yaml @@ -34,6 +34,7 @@ body: - area:file - area:gcp-cloud-run - area:gcp-gce + - area:graphql - area:host - area:http - area:k8s diff --git a/.github/ISSUE_TEMPLATE/new-conventions.yaml b/.github/ISSUE_TEMPLATE/new-conventions.yaml index e0d54225ca..4eeae1d515 100644 --- a/.github/ISSUE_TEMPLATE/new-conventions.yaml +++ b/.github/ISSUE_TEMPLATE/new-conventions.yaml @@ -43,6 +43,7 @@ body: - area:file - area:gcp-cloud-run - area:gcp-gce + - area:graphql - area:host - area:http - area:k8s diff --git a/docs/attributes-registry/README.md b/docs/attributes-registry/README.md index e2f068fc5a..13b3fd3777 100644 --- a/docs/attributes-registry/README.md +++ b/docs/attributes-registry/README.md @@ -48,6 +48,7 @@ Currently, the following namespaces exist: * [File](file.md) * [Google Cloud Run](gcp-cloud-run.md) * [Google Compute Engine](gcp-gce.md) +* [GraphQl](graphql.md) * [Host](host.md) * [HTTP](http.md) * [K8s](k8s.md) diff --git a/docs/attributes-registry/graphql.md b/docs/attributes-registry/graphql.md new file mode 100644 index 0000000000..4beae15f1d --- /dev/null +++ b/docs/attributes-registry/graphql.md @@ -0,0 +1,24 @@ + + +# GraphQL + +## GraphQL Attributes + + +| Attribute | Type | Description | Examples | Stability | +|---|---|---|---|---| +| `graphql.document` | string | The GraphQL document being executed. [1] | `query findBookById { bookById(id: ?) { name } }` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `graphql.operation.name` | string | The name of the operation being executed. | `findBookById` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `graphql.operation.type` | string | The type of the operation being executed. | `query`; `mutation`; `subscription` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** The value may be sanitized to exclude sensitive information. + +`graphql.operation.type` MUST be one of the following: + +| Value | Description | Stability | +|---|---|---| +| `query` | GraphQL query | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `mutation` | GraphQL mutation | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| `subscription` | GraphQL subscription | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + \ No newline at end of file diff --git a/docs/graphql/graphql-spans.md b/docs/graphql/graphql-spans.md index e0d30aaa9b..a92d27275f 100644 --- a/docs/graphql/graphql-spans.md +++ b/docs/graphql/graphql-spans.md @@ -14,12 +14,12 @@ The **span name** MUST be of the format ` `. 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` | string | The GraphQL document being executed. [1] | `query findBookById { bookById(id: ?) { name } }` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `graphql.operation.name` | string | The name of the operation being executed. | `findBookById` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | -| `graphql.operation.type` | string | The type of the operation being executed. | `query`; `mutation`; `subscription` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) | +| [`graphql.document`](../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`](../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`](../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. diff --git a/model/registry/graphql.yaml b/model/registry/graphql.yaml new file mode 100644 index 0000000000..460444d891 --- /dev/null +++ b/model/registry/graphql.yaml @@ -0,0 +1,36 @@ +groups: + - id: registry.graphql + prefix: graphql + type: attribute_group + brief: 'This document defines attributes for GraphQL.' + attributes: + - id: operation.name + brief: "The name of the operation being executed." + type: string + stability: experimental + examples: 'findBookById' + - id: operation.type + brief: "The type of the operation being executed." + stability: experimental + type: + allow_custom_values: false + members: + - id: query + value: "query" + brief: "GraphQL query" + stability: experimental + - id: mutation + value: "mutation" + brief: "GraphQL mutation" + stability: experimental + - id: subscription + value: "subscription" + brief: "GraphQL subscription" + stability: experimental + examples: ['query', 'mutation', 'subscription'] + - id: document + brief: "The GraphQL document being executed." + type: string + stability: experimental + note: The value may be sanitized to exclude sensitive information. + examples: 'query findBookById { bookById(id: ?) { name } }' diff --git a/model/trace/instrumentation/graphql.yml b/model/trace/instrumentation/graphql.yml index 6e311afa69..a14948da0a 100644 --- a/model/trace/instrumentation/graphql.yml +++ b/model/trace/instrumentation/graphql.yml @@ -1,38 +1,13 @@ groups: - id: graphql - prefix: graphql type: span 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 - stability: experimental - examples: 'findBookById' - - id: operation.type - brief: "The type of the operation being executed." - stability: experimental - type: - allow_custom_values: false - members: - - id: query - value: "query" - brief: "GraphQL query" - stability: experimental - - id: mutation - value: "mutation" - brief: "GraphQL mutation" - stability: experimental - - id: subscription - value: "subscription" - brief: "GraphQL subscription" - stability: experimental - examples: ['query', 'mutation', 'subscription'] - - id: document - brief: "The GraphQL document being executed." - type: string - stability: experimental - note: The value may be sanitized to exclude sensitive information. - examples: 'query findBookById { bookById(id: ?) { name } }' + - ref: graphql.operation.name + requirement_level: recommended + - ref: graphql.operation.type + requirement_level: recommended + - ref: graphql.document + requirement_level: recommended