-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define how to enable Meter attributes for Prometheus Exporter #2035
Define how to enable Meter attributes for Prometheus Exporter #2035
Conversation
7ea2a64
to
7877870
Compare
Related to #2040. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I'm not sure if your pr is necessarily opposed to my intent at least. What i would ask is whether Exporters MUST or MAY export the labels. My concern is cardinality. I fully agree that it changes the metrics but I believe the SDK user should have that control. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An OTLP exporter doesn't need these options because the protocol includes these fields explicitly. A non-OTLP exporter could use these options, but I wonder if they can be configured via Views. There are already semantic conventions for naming these fields when projecting into non-OTLP systems (from the tracing spec), so I imagine a special case in the View machinery to recognize special cases for instrumentation library name/version, then synthesizing those attributes.
d09c880
to
0af34e2
Compare
I think that makes sense, I'm just trying to envisage how that might work. Potentially a provider to the view. Also during the meeting you mentioned something related to how we might use views to add the attributes exported via resources. However, I don't believe that with https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#resource-sdk we would require any additional languages.
|
@reyang I believe based on the comments @jsuereth and the updates I have made, this should be a bit closer to something useful. |
0cc8bf8
to
8a6cf18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
3f9929a
to
5a3cae2
Compare
I think at this point it just needs approval from @jmacd and/or some other owner. |
5a3cae2
to
445304d
Compare
6bed38d
to
5f12e3d
Compare
* Add `OTEL_EXPORTER_PROMETHEUS_ADD_METER_ATTRIBUTES` variable * Update Metric SDK to clarify when Meter attributes should be exported. Fixes open-telemetry#1906 Signed-off-by: Harold Dost <[email protected]>
5f12e3d
to
6274440
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving this as a non-blocking comment, but one I that is important (and would make blocking if that didn't restrict merging so much).
TL;DR; I think we need to do a bit better around Prometheus Attributes. I don't want to stand in the way of progress, but I'd like to see a prototype and some usage before specification, because I think this is actually a very tricky thing to get right. Specifically I don't think this PR goes far enough.
- This PR doesn't account for
Resource
attributes and when those should make it to prometheus, It only accounts for those coming fromMeter
. I think both are important, and if you look at Initial draft of Prometheus <-> OTLP datamodel specification. #2017 You'll see some details there. - I believe mapping instrumentation-library-name to labels should be done by default in prometheus exporter (as is the case for trace). Additionally I think it's more important for fine-grained code-based configuration with coarse-grained env variables.
- There should be a consistent configuration used for mapping Resource + InstrumentationLibrary attributes to prometheus exported metrics. I think "all" or "nothing" is not quite right here, but is a decent start.
To make progress:
- @hdost Would you be willing to put together a prototype or more example use case here around what attributes across all of OTLP should be in prometheus? I'm happy to help, just overloaded in time at the moment trying to build the otel roadmap.
- I think we should make sure the prometheus-wg has a chance to chime in on this PR. CC @alolita to make sure we have some review from that group.
- I'd make a counter-proposal with the following:
- A single environment variable that takes a set of attributes to map into prometheus labels. If it's empty, all are mapped by default.
- A set of conventional names for instrumentation library
otel.library.version
andotel.library.name
are what we used for tracing. These would implicitly be used to denote library should be mapped into promtheus label.
Additionally We actually think about using this convention for non-prometheus backends. Specifically, I discovered these are missing in the Google Cloud Monitoring exporter, and it actually leads to duplicate point errors because the instrumentation library identity is actually a part of the metric identity and should be exported by default for correct behavior.
I think I can arrange time to do that. What is the timeframe we are looking so I can prioritize?
That makes perfect sense.
I believe we did talk about something like this, and I would agree that I think makes a lot of sense. Potentially an addendum.
|
I'd like to see a prototype/usage example in prometheus prior to merging the specification change, if that's feasible. |
@jsuereth Yup, I was more wondering in the context of timeline, is the goal to have this behavior defined before Feature freeze of he SDK or just stabilization. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
@hdost IIUC - Prometheus Exporter specification can happen post SDK-freeze unless you need a feature from the SDK for this. It's my understanding that we do not need SDK features for this, so we're free to take some time to get this right. I'd like to make sure whatever you do here lines up with the formal specification for prometheus. I think the only thing I'm objecting too on this PR right now is that I think adding |
We discussed this at length in the Prometheus working group SIG and consulted with @brian-brazil. There is a fundamental question which is practically orthogonal to the issue at hand, which is when can we ever say that two metrics are the "same". This question borders on philosophical--we discussed a hypothetical set of two libraries both with a "request_count" metric. Brian's experience says that rarely are two implementations exactly the same, so they should be considered different almost always. While Here are the recommendations we arrived at when we landed this discussion:
|
Oh so now that is quite interesting 🤔 basically this would namespace things, so if you're instrumenting I could see this exploding the metric name length depending on what comes through. Edit: i saw from the meeting notes "Solution: Do not prefix else always prefix." |
|
||
Known values for `OTEL_EXPORTER_PROMETHEUS_ADD_METER_ATTRIBUTES` are: | ||
|
||
- `true` : Add the Meter `name` and `version` as Attributes on the metrics exported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some quick prototype in .NET open-telemetry/opentelemetry-dotnet#2593.
Couple findings:
- the label name
name
andversion
are concerning, I think it is very likely to conflict with existing labels (it is totally possible to invent some rule although I didn't cover it in the prototype). - the Metrics API Spec guarantees a non-empty meter name, however there is no guarantee on the meter version. I think we should call out here what's the behavior if version is not available or is an empty string.
- I think there are many cases people might care about the meter name, but not the version, I think the current proposal (having both or nothing) might be less useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please find addition feedback based on the prototype https://github.com/open-telemetry/opentelemetry-specification/pull/2035/files#r747236300.
Known values for `OTEL_EXPORTER_PROMETHEUS_ADD_METER_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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it meant to be "Prometheus labels" instead of "Attributes"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since some backends has reserved words for tag name, I would try to choose something more specific than name
and version
, like meter_name
and meter_version
. Also, if I see name and version on the tags, I'm not sure it will be clear to me what these exactly mean.
(Not really Prometheus-related but datadog reserves version
)
As discussed in the SIG call today, we should be using the same attribute names already specified for tracing systems for consistency. This means "otel.library.name" and "otel.library.version", which in a Prometheus setting should have dots converted to underscores. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Fixes #1906
Changes
OTEL_METRICS_LIBRARY_ATTRIBUTES
variableRelated issues #1953