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

Signed-off-by: Harold Dost <[email protected]>
  • Loading branch information
hdost committed Oct 21, 2021
1 parent de30f81 commit 0af34e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions specification/metrics/sdk_exporters/prometheus.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@
Prometheus Exporter is a [Pull Metric Exporter](../sdk.md#pull-metric-exporter)
which reacts to the Prometheus scraper and report the metrics passively to
[Prometheus](https://prometheus.io/).

Prometheus Exporter MUST export Meter `library` and `version` information when
enabled by the [Metrics SDK Configuration](../../sdk-environment-variables.md#metrics-sdk-configuration).
The Prometheus Exporter MUST respect the configuration preferences of the application
provide a method to configure whether these data are exported as
[Attributes](../common/common.md#attributes). The `library` and `version` information
will follow the same naming as [trace exporters.](../../trace/sdk_exporters/non-otlp.md#instrumentationlibrary)
9 changes: 7 additions & 2 deletions specification/sdk-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,13 @@ thrift or protobuf. As of 1.0 of the specification, there

| Name | Description | Default |
| ----------------------------- | --------------------------------| ---------------------------- |
| OTEL_EXPORTER_PROMETHEUS_HOST | Host used by the Prometheus exporter | All addresses: "0.0.0.0"|
| OTEL_EXPORTER_PROMETHEUS_PORT | Port used by the Prometheus exporter | 9464 |
| `OTEL_EXPORTER_PROMETHEUS_HOST` | Host used by the Prometheus exporter | All addresses: "0.0.0.0"|
| `OTEL_EXPORTER_PROMETHEUS_PORT` | Port used by the Prometheus exporter | 9464 |
| `OTEL_EXPORTER_PROMETHEUS_LIBRARY_ATTRIBUTES` | Filter for if `library` and `version` from [Meter](./metrics/api.md#get-a-meter) are exported. | `false` | |

Known values for `OTEL_EXPORTER_PROMETHEUS_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.

## Exporter Selection

Expand Down

0 comments on commit 0af34e2

Please sign in to comment.