> Source: https://www.ymotongpoo.com/works/otel-specs-ja/semconv/graphql/graphql-spans/


# GraphQLサーバースパンに関するセマンティック規約

**ステータス**: [Development][DocumentStatus]

<!-- semconv span.graphql.server -->
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
<!-- see templates/registry/markdown/snippet.md.j2 -->
<!-- prettier-ignore-start -->

**Status:** ![Development](https://img.shields.io/badge/-development-blue)

このスパンは、GraphQLサーバー実装への受信操作を表します。

`graphql.operation.type`が利用可能な場合、**スパン名**は`{graphql.operation.type}`という形式であるべきです（SHOULD）。`graphql.operation.type`が利用できない場合、スパンは`GraphQL Operation`と名付けられるべきです（SHOULD）。

> [!WARNING]
> `graphql.operation.name`の値はクライアントによって提供され、高いカーディナリティを持つ場合があります。これを（デフォルトで）GraphQLサーバースパン名に使うことは推奨されません（NOT RECOMMENDED）。
>
> `graphql.operation.name`が利用可能な場合に、`{graphql.operation.type} {graphql.operation.name}`という形式でより説明的なスパン名を有効にする設定オプションを、計装は提供してもかまいません（MAY）。

**スパン種別**は`SERVER`であるべきです（SHOULD）。

**スパンステータス**は[エラーの記録](/works/otel-specs-ja/semconv/general/recording-errors/)文書に従うべきです（SHOULD）。

**Attributes:**

| Key | Stability | [Requirement Level](/works/otel-specs-ja/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
| --- | --- | --- | --- | --- | --- |
| [`graphql.operation.name`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/graphql/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | 実行される操作の名前。 | `findBookById` |
| [`graphql.operation.type`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/graphql/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | 実行される操作の種別。 | `query`; `mutation`; `subscription` |
| [`graphql.document`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/graphql/) | ![Development](https://img.shields.io/badge/-development-blue) | `Opt-In` | string | 実行されるGraphQLドキュメント。[1] | `query findBookById { bookById(id: ?) { name } }` |

**[1] `graphql.document`:** 計装が機密情報を確実に識別・削除できる場合は、そうすべきです（SHOULD）。

---

`graphql.operation.type`には、次のよく知られた値の一覧があります。これらのいずれかが該当する場合は、対応する値を使用しなければなりません（MUST）。そうでない場合は、独自の値を使用してもかまいません（MAY）。

| Value | Description | Stability |
| --- | --- | --- |
| `mutation` | GraphQL mutation | ![Development](https://img.shields.io/badge/-development-blue) |
| `query` | GraphQL query | ![Development](https://img.shields.io/badge/-development-blue) |
| `subscription` | GraphQL subscription | ![Development](https://img.shields.io/badge/-development-blue) |

<!-- prettier-ignore-end -->
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

