> Source: https://www.ymotongpoo.com/works/otel-specs-ja/semconv/dns/dns-metrics/


# DNSクエリに関するセマンティック規約

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

この文書では、DNSクエリを計装するときに適用するセマンティック規約を定義します。

## メトリクス

### メトリクス: `dns.lookup.duration`

このメトリクスは[opt-in][MetricOptIn]です。

このメトリクスは、`[ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ]` の[`ExplicitBucketBoundaries` advisoryパラメータ](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.59.0/specification/metrics/api.md#instrument-advisory-parameters)を指定すべきです（SHOULD）。

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

| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `dns.lookup.duration` | Histogram | `s` | DNSルックアップの実行に要した時間を計測します。 | ![Development](https://img.shields.io/badge/-development-blue) | |

**Attributes:**

| Key | Stability | [Requirement Level](/works/otel-specs-ja/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
| --- | --- | --- | --- | --- | --- |
| [`dns.question.name`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/dns/) | ![Development](https://img.shields.io/badge/-development-blue) | `Required` | string | クエリの対象となる名前。[1] | `www.example.com`; `dot.net` |
| [`error.type`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/error/) | ![Stable](https://img.shields.io/badge/-stable-lightgreen) | `Conditionally Required` if and only if an error has occurred. | string | DNSルックアップが失敗した原因となったエラーを記述します。[2] | `host_not_found`; `no_recovery`; `java.net.UnknownHostException` |

**[1] `dns.question.name`:** この名前は、追加の正規化を行わずDNSクエリに現れる形式のまま、クエリ対象のドメイン名を表します。

**[2] `error.type`:** 計装は、`getaddrinfo`（[LinuxなどのPOSIXシステム](https://man7.org/linux/man-pages/man3/getaddrinfo.3.html) / [Windows](https://learn.microsoft.com/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo)）が報告するエラーコード、またはランタイムやクライアントライブラリが報告するエラーコードを使用すべきです（SHOULD）。エラーコードが利用できない場合は、例外型の完全な名前を使用すべきです（SHOULD）。

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `_OTHER` | 計装が独自の値を定義していない場合に使用するフォールバック用のエラー値。 | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |

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

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
[MetricOptIn]: /works/otel-specs-ja/semconv/general/metric-requirement-level/#opt-in

