feat: add support for configuring scope info metric attributes for the Prometheus exporter and refactor conversion to Prometheus metrics#5123
Conversation
MikeGoldsmith
left a comment
There was a problem hiding this comment.
This looks like it's on the right path. A few things to note:
-
_SCOPE_ATTR_CONFLICT_NAMESis defined but never used — we should either use it to explicitly filter conflicting scope attributes or remove it. -
PR description looks copy-pasted from #5122 — says "Resource metrics as Metric attributes" but this is about scope info.
-
Merge conflict concern — this, #5122, #5118, and #5117 all modify
PrometheusMetricReaderand_translate_to_prometheus. This is going to conflict with them, we need to coordinate what should be done in order or we'll be bumping into each other with rebases. -
nit: the nesting depth in
_translate_to_prometheusis getting deep — might be worth extracting the per-metric logic into a helper in a follow-up.
Sorry, got a little sloppy with this PR. I originally used |
|
@MikeGoldsmith I ended up doing a pretty major refactor of the exporter logic based on your suggestion, so we will likely want to merge this PR first. |
MikeGoldsmith
left a comment
There was a problem hiding this comment.
Looks good, thanks @herin049. Need to update PR title and description.
ef6fede to
4a590f0
Compare
4a590f0 to
be41170
Compare
|
Hey, just a heads-up from the Prometheus SIG: please hold off on the merge here. There's on going discussion happening on the PR that stabilizes this part of the spec open-telemetry/opentelemetry-specification#5056 |
|
Moving to draft until the SIG confirms this is the correct path. |
|
Thanks for the PR! Just a heads-up: we no longer update Please add the appropriate changelog fragment for this change instead of editing |
|
Seems like the discussion in the spec PR has settled and |
…en-telemetry#5056) Fixes open-telemetry#4989 ## Changes Stabilizes the configuration option `without_scope_info`, documented in the Prometheus exporter spec. It is implemented by a few SDKs already open-telemetry#4989 (comment), an open PR for Python(open-telemetry/opentelemetry-python#5123), and an issue for DotNet(open-telemetry/opentelemetry-dotnet#7157). Both prometheus exporters in the collector have the option as well[[1](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/prometheusexporter#:~:text=without_scope_info%3A%20(default%20%3D%20false)%3A%20If%20true%2C%20metrics%20will%20be%20exported%20without%20scope%20name%2C%20version%2C%20schemaURL%2C%20and%20attributes%20encoded%20as%20labels.)][[2](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/prometheusremotewriteexporter#:~:text=disable_scope_info%20(default%20%3D%20false)%3A%20If%20true%2C%20the%20scope%20info%20labels%20(otel_scope_name%2C%20otel_scope_version%20and%20otel_scope_...%20attributes)%20will%20not%20be%20exported.)] (Although remote write exporter uses `disable_scope_info` instead of `without_scope_info`. For non-trivial changes, follow the [change proposal process](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CONTRIBUTING.md#proposing-a-change). * [X] Related issues open-telemetry#4989 * [ ] Related [OTEP(s)](https://github.com/open-telemetry/oteps) # * [ ] Links to the prototypes (when adding or changing features) * [X] [`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md) file updated for non-trivial changes * For trivial changes, include `[chore]` in the PR title to skip the changelog check * [ ] [Spec compliance matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix/template.yaml) updated if necessary * [ ] [Declarative config data model](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/data-model.md#overview) is updated if SDK config surface is changed --------- Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
Description
Adds support for configuring scope attributes for the Prometheus exporter in accordance to the Prometheus spec and refactor conversion to Prometheus metrics.
Fixes #5112
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Does This PR Require a Contrib Repo Change?
Checklist: