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

Metric requirement levels #3237

Merged
merged 11 commits into from
Feb 23, 2023
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ release.

### Metrics

- Add metric requirement levels "Required", "Recommended", and "Opt-In".
([#3237](https://github.com/open-telemetry/opentelemetry-specification/pull/3237))

### Logs

- Rename Logs API to Logs Bridge API to prevent confusion.
Expand Down
4 changes: 3 additions & 1 deletion semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ i.e.:
## Writing semantic conventions

Semantic conventions for the spec MUST adhere to the
[attribute naming](../specification/common/attribute-naming.md) and [requirement level](../specification/common/attribute-requirement-level.md) conventions.
[attribute naming](../specification/common/attribute-naming.md),
[attribute requirement level](../specification/common/attribute-requirement-level.md),
and [metric requirement level](../specification/metrics/metric-requirement-level.md) conventions.

Refer to the [syntax](https://github.com/open-telemetry/build-tools/tree/v0.15.1/semantic-conventions/syntax.md)
for how to write the YAML files for semantic conventions and what the YAML properties mean.
Expand Down
1 change: 1 addition & 0 deletions specification/metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ SDK](../overview.md#sdk) concept for more information.
* [Metrics API](./api.md)
* [Metrics SDK](./sdk.md)
* [Metrics Data Model and Protocol](./data-model.md)
* [Metrics Requirement Levels](./metric-requirement-level.md)
* [Semantic Conventions](./semantic_conventions/README.md)

## References
Expand Down
40 changes: 40 additions & 0 deletions specification/metrics/metric-requirement-level.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Metric Requirement Levels for Semantic Conventions
trask marked this conversation as resolved.
Show resolved Hide resolved

**Status**: [Experimental](../document-status.md)

<details>
<summary>Table of Contents</summary>

<!-- toc -->

- [Required](#required)
- [Recommended](#recommended)
- [Opt-In](#opt-in)

<!-- tocstop -->

</details>

The following metric requirement levels are specified:

- [Required](#required)
- [Recommended](#recommended)
- [Opt-In](#opt-in)

## Required

All instrumentations MUST emit the metric.
A semantic convention defining a Required metric expects that an absolute majority of instrumentation libraries and applications are able to efficiently emit it.

## Recommended

Instrumentations SHOULD emit the metric by default if it's readily available and can be efficiently emitted. Instrumentations MAY offer a configuration option to disable Recommended metrics.

Instrumentations that decide not to emit `Recommended` metrics due to performance, security, privacy, or other consideration by default, SHOULD allow for opting in to emitting them as defined for the `Opt-In` requirement level if the metrics are logically applicable.

## Opt-In

Instrumentations SHOULD emit the metric if and only if the user configures the instrumentation to do so.
Instrumentation that doesn't support configuration MUST NOT emit `Opt-In` metrics.

This attribute requirement level is recommended for metrics that are particularly expensive to retrieve or might pose a security or privacy risk. These should therefore only be enabled deliberately by a user making an informed decision.