Skip to content

Commit

Permalink
Prometheus Exporter Meter attribute handling
Browse files Browse the repository at this point in the history
* Add `OTEL_EXPORTER_PROMETHEUS_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 25, 2021
1 parent a49a41f commit c3c364e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ release.
([#2038](https://github.com/open-telemetry/opentelemetry-specification/pull/2038))
- Specify that the SDK must support exporters to access meter information.
([#2040](https://github.com/open-telemetry/opentelemetry-specification/pull/2040))
- Define how Prometheus should handle Meter attributes.
([#2035](https://github.com/open-telemetry/opentelemetry-specification/pull/2035))

### Logs

Expand Down
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 `name` 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 `name` and `version` information
will follow the same naming as [trace exporters.](../../trace/sdk_exporters/non-otlp.md#instrumentationlibrary)
10 changes: 8 additions & 2 deletions specification/sdk-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,14 @@ 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 `name` 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 c3c364e

Please sign in to comment.