Skip to content

Commit

Permalink
Define how to enable Meter attributes.
Browse files Browse the repository at this point in the history
* Add `OTEL_METRICS_LIBRARY_ATTRIBUTES` variable
* Update Metric SDK to clarify when Meter attributes should be exported.

Fixes open-telemetry#1906
  • Loading branch information
hdost committed Oct 19, 2021
1 parent de30f81 commit 7ea2a64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions specification/metrics/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,11 @@ modeled to interact with other components in the SDK:
The SDK MUST provide configuration according to the [SDK environment
variables](../sdk-environment-variables.md) specification.

The SDK MAY export `library` and `version` information. Details found in the
[Metrics SDK Configuration](../sdk-environment-variables.md#metrics-sdk-configuration)
The SDK MUST respect the configuration preferences of the application provide a
method to configure whether these data are exported as Attributes.

## Numerical limits handling

The SDK MUST handle numerical limits in a graceful way according to [Error
Expand Down
5 changes: 5 additions & 0 deletions specification/sdk-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,18 @@ Known values for OTEL_METRICS_EXPORTER are:
| Name | Description | Default | Notes |
|-----------------|---------|-------------|---------|
| `OTEL_METRICS_EXEMPLAR_FILTER` | Filter for which measurements can become Exemplars. | `"with_sampled_trace"` | |
| `OTEL_METRICS_LIBRARY_ATTRIBUTES` | Filter for if `library` and `version` from [Meter](./metrics/api.md#get-a-meter) are exported. | `false` | |

Known values for `OTEL_METRICS_EXEMPLAR_FILTER` are:

- `"none"`: No measurements are eligble for exemplar sampling.
- `"all"`: All measurements are eligible for exemplar sampling.
- `"with_sampled_trace"`: Only allow measurements with a sampled parent span in context.

Known values for `OTEL_METRICS_LIBRARY_ATTRIBUTES` are:
- `true` : Add the Meter `name` and `version` as Attributes on the metrics exported.
- `false` : Don't add Meter `name` and `version` as Attributes on the metrics exported.

## Language Specific Environment Variables

To ensure consistent naming across projects, this specification recommends that language specific environment variables are formed using the following convention:
Expand Down

0 comments on commit 7ea2a64

Please sign in to comment.