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


# FaaSメトリクスに関するセマンティック規約

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

この文書では、サーバーのプロビジョニングや管理を伴わずに実行される関数のインスタンス（サーバーレス関数、Function as a Service（FaaS）とも呼ばれます）をメトリクスで記述する方法を定義します。

この節で説明する規約は、FaaS（Function as a Service）に固有のものです。FaaSの操作が発生すると、その操作についての洞察を提供するために、その操作についてのメトリクスイベントが生成され報告されます。メトリクスイベントにFaaS属性を追加することで、きめ細かいフィルタリングが可能になります。

## メトリクスInstrument

次のメトリクスInstrumentは、FaaSの操作を記述します。

### FaaSインスタンス

次のメトリクスは、FaaSインスタンスによって記録されます。

#### メトリクス: `faas.invoke_duration`

このメトリクスは[recommended][MetricRecommended]です。

このメトリクスは、`[ 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.faas.invoke_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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.invoke_duration` | Histogram | `s` | 関数のロジックの実行時間を計測します。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.init_duration`

このメトリクスは[recommended][MetricRecommended]です。

このメトリクスは、`[ 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.faas.init_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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.init_duration` | Histogram | `s` | 関数の初期化（コールドスタートなど）の実行時間を計測します。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.coldstarts`

このメトリクスは[recommended][MetricRecommended]です。

<!-- semconv metric.faas.coldstarts -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.coldstarts` | Counter | `{coldstart}` | 呼び出しのコールドスタート数。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.errors`

このメトリクスは[recommended][MetricRecommended]です。

<!-- semconv metric.faas.errors -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.errors` | Counter | `{error}` | 呼び出しエラー数。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.invocations`

このメトリクスは[recommended][MetricRecommended]です。

<!-- semconv metric.faas.invocations -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.invocations` | Counter | `{invocation}` | 呼び出しの成功数。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.timeouts`

このメトリクスは[recommended][MetricRecommended]です。

<!-- semconv metric.faas.timeouts -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.timeouts` | Counter | `{timeout}` | 呼び出しのタイムアウト数。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.mem_usage`

このメトリクスは[recommended][MetricRecommended]です。

<!-- semconv metric.faas.mem_usage -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.mem_usage` | Histogram | `By` | 呼び出しごとの最大メモリ使用量の分布。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.cpu_usage`

このメトリクスは[recommended][MetricRecommended]です。

このメトリクスは、`[ 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.faas.cpu_usage -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.cpu_usage` | Histogram | `s` | 呼び出しごとのCPU使用量の分布。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

#### メトリクス: `faas.net_io`

このメトリクスは[recommended][MetricRecommended]です。

<!-- semconv metric.faas.net_io -->
<!-- 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 |
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
| `faas.net_io` | Histogram | `By` | 呼び出しごとのネットワークI/O使用量の分布。 | ![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 |
| --- | --- | --- | --- | --- | --- |
| [`faas.trigger`](https://opentelemetry.io/docs/specs/semconv/registry/attributes/faas/) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | この関数呼び出しの原因となったトリガーの種類。 | `datasource`; `http`; `pubsub` |

---

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

| Value | Description | Stability |
| --- | --- | --- |
| `datasource` | データベースやファイルシステムの読み書きなど、データソースの操作に対する応答。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `http` | 受信したHTTPリクエストへの応答を提供する。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `other` | 他のいずれにも当てはまらない場合。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `pubsub` | メッセージングシステムにメッセージが送信されたときに実行されるよう設定された関数。 | ![Development](https://img.shields.io/badge/-development-blue) |
| `timer` | 定期的に実行されるようスケジュールされた関数。 | ![Development](https://img.shields.io/badge/-development-blue) |

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

## 参考文献

### メトリクスの参考文献

以下は、さまざまなFaaSプロバイダーで利用可能なメトリクスに関する文書へのリンクです。これは網羅的な一覧ではありません。

* [AWS Lambda Metrics](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html)
* [AWS Lambda Insight Metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-metrics.html)
* [Azure Functions Metrics](https://docs.microsoft.com/azure/azure-monitor/platform/metrics-supported)
* [Google CloudFunctions Metrics](https://cloud.google.com/monitoring/api/metrics_gcp_c#gcp-cloudfunctions)
* [OpenFaas Metrics](https://docs.openfaas.com/architecture/metrics/)

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

