Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FaaS metrics semantic conventions #1736

Merged
merged 10 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ release.
[#1731](https://github.com/open-telemetry/opentelemetry-specification/pull/1731),
[#1733](https://github.com/open-telemetry/opentelemetry-specification/pull/1733))
- Mark relevant portions of Metrics Data Model stable ([#1728](https://github.com/open-telemetry/opentelemetry-specification/pull/1728))
- Add FaaS metrics semantic conventions ([#1736](https://github.com/open-telemetry/opentelemetry-specification/pull/1736))
arminru marked this conversation as resolved.
Show resolved Hide resolved

### Logs

Expand Down
1 change: 1 addition & 0 deletions specification/metrics/semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The following semantic conventions surrounding metrics are defined:
* [System Metrics](system-metrics.md): Semantic conventions and instruments for standard system metrics.
* [Process Metrics](process-metrics.md): Semantic conventions and instruments for standard process metrics.
* [Runtime Environment Metrics](runtime-environment-metrics.md): Semantic conventions and instruments for runtime environment metrics.
* [FaaS Metrics](faas-metrics.md): Semantic conventions and instruments for FaaS metrics.

Apart from semantic conventions for metrics and
[traces](../../trace/semantic_conventions/README.md), OpenTelemetry also
Expand Down
77 changes: 77 additions & 0 deletions specification/metrics/semantic_conventions/faas-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# General
arminru marked this conversation as resolved.
Show resolved Hide resolved

arminru marked this conversation as resolved.
Show resolved Hide resolved
**Status**: [Experimental](../../document-status.md)

This document defines how to describe an instance of a function that runs without provisioning
or managing of servers (also known as serverless functions or Function as a Service (FaaS)) with metrics.

The conventions described in this section are FaaS (function as a service) specific. When FaaS operations occur,
metric events about those operations will be generated and reported to provide insights into the
operations. By adding FaaS labels to metric events it allows for finely tuned filtering.

**Disclaimer:** These are initial FaaS metric instruments and labels but more may be added in the future.

<!-- Re-generate TOC with `markdown-toc --no-first-h1 -i` -->

<!-- toc -->
- [Metric Instruments](#metric-instruments)
* [FaaS Invocations](#faas-invocations)
- [Labels](#labels)
arminru marked this conversation as resolved.
Show resolved Hide resolved
- [References](#references)
* [Metric References](#metric-references)
<!-- tocstop -->

## Metric Instruments

The following metric instruments MUST be used to describe FaaS operations. They MUST be of the specified
type and units.

### FaaS Invocations

Below is a table of FaaS invocation metric instruments.

| Name | Instrument | Units | Description |
|------|------------|----|-------------|
| `faas.invoke_duration` | Histogram | milliseconds | Measures the duration of the invocation |
| `faas.init_duration` | Histogram | milliseconds | Measures the duration of the function's initialization, such as a cold start |
| `faas.coldstarts` | Counter | default unit | Number of invocation cold starts. |
| `faas.errors` | Counter | default unit | Number of invocation errors. |
| `faas.executions` | Counter | default unit | Number of successful invocations. |
| `faas.timeouts` | Counter | default unit | Number of invocation timeouts. |

Optionally, when applicable:

| Name | Instrument | Units | Description |
|------|------------|----|-------------|
| `faas.mem_usage` | Histogram | bytes | Distribution of max memory usage per invocation |
| `faas.cpu_usage` | Histogram | milliseconds | Distribution of cpu usage per invocation |
| `faas.net_io` | Histogram | bytes | Distribution of net I/O usage per invocation |

## Labels

Below is a table of the labels to be included on FaaS metric events.

| Name | Recommended | Notes and examples |
|------|-------------|--------------------|
| `faas.trigger` | Yes | Type of the trigger on which the function is invoked. SHOULD be one of: `datasource`, `http`, `pubsub`, `timer`, `other` |
| `faas.invoked_name` | Yes | Name of the invoked function. Example: `my-function` |
| `faas.invoked_provider` | Yes | Cloud provider of the invoked function. Corresponds to the resource `cloud.provider`. Example: `aws` |
| `faas.invoked_region` | Yes | Cloud provider region of invoked function. Corresponds to resource `cloud.region`. Example: `us-east-1` |

arminru marked this conversation as resolved.
Show resolved Hide resolved
More details on these labels, the function name and the difference compared to the faas.invoked_name can be found at the related [FaaS tracing specification](../../trace/semantic_conventions/faas.md).
arminru marked this conversation as resolved.
Show resolved Hide resolved
For incoming FaaS executions, the function for which metrics are reported is already described by its [FaaS resource attributes](../../resource/semantic_conventions/faas.md).
Outgoing FaaS executions are identified using the `faas.invoked_*` attributes above.
`faas.trigger` SHOULD be included in all metric events while `faas.invoked_*` attributes apply on outgoing FaaS execution events only.

## References

### Metric References

Below are links to documentation regarding metrics that are available with different
FaaS providers. This list is not exhaustive.

* [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#gcp-cloudfunctions)
* [OpenFaas Metrics](https://docs.openfaas.com/architecture/metrics/)