From d09c8803f4ca38c3923ded0f05bbd5d0e64e410a Mon Sep 17 00:00:00 2001 From: Harold Dost Date: Tue, 19 Oct 2021 15:07:11 +0200 Subject: [PATCH] Define how to enable Meter attributes. * Add `OTEL_METRICS_LIBRARY_ATTRIBUTES` variable * Update Metric SDK to clarify when Meter attributes should be exported. Fixes #1906 Signed-off-by: Harold Dost --- specification/metrics/sdk_exporters/prometheus.md | 7 +++++++ specification/sdk-environment-variables.md | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/specification/metrics/sdk_exporters/prometheus.md b/specification/metrics/sdk_exporters/prometheus.md index 4edcf3625b2..57f9a3a48a2 100644 --- a/specification/metrics/sdk_exporters/prometheus.md +++ b/specification/metrics/sdk_exporters/prometheus.md @@ -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 `telemetry` [semantic_conventions](../../../semantic_conventions/resource/telemetry.yaml). diff --git a/specification/sdk-environment-variables.md b/specification/sdk-environment-variables.md index 2e360272810..f9743a99360 100644 --- a/specification/sdk-environment-variables.md +++ b/specification/sdk-environment-variables.md @@ -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