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
Optionally print OM created lines #1408
base: main
Are you sure you want to change the base?
Conversation
c26d312
to
b7d00b2
Compare
e930252
to
240345e
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.
Thanks! One minor nit, otherwise well done!
33ed3e6
to
e9c6f77
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.
Epic, proposed some improvements, thanks!
prometheus/promhttp/http.go
Outdated
// possible options during content negotiation. Note that Prometheus | ||
// 2.5.0+ will negotiate OpenMetrics as first priority. OpenMetrics is | ||
// the only way to transmit exemplars. However, the move to OpenMetrics | ||
// is not completely transparent. Most notably, the values of "quantile" | ||
// labels of Summaries and "le" labels of Histograms are formatted with | ||
// a trailing ".0" if they would otherwise look like integer numbers | ||
// (which changes the identity of the resulting series on the Prometheus | ||
// server). |
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.
// possible options during content negotiation. Note that Prometheus | |
// 2.5.0+ will negotiate OpenMetrics as first priority. OpenMetrics is | |
// the only way to transmit exemplars. However, the move to OpenMetrics | |
// is not completely transparent. Most notably, the values of "quantile" | |
// labels of Summaries and "le" labels of Histograms are formatted with | |
// a trailing ".0" if they would otherwise look like integer numbers | |
// (which changes the identity of the resulting series on the Prometheus | |
// server). | |
// possible options during content negotiation. | |
// | |
// Note that Prometheus 2.5.0+ might negotiate OpenMetrics Text format | |
// as first priority unless user uses custom scrape protocol prioritization or | |
// histograms feature is enabled (then Prometheus proto format is prioritized, | |
// which client_golang supports). | |
// | |
// The main reason for enabling OpenMetrics Text was to enable exemplars, | |
// but Prometheus proto has that as feature as well. | |
// | |
// However, the move to OpenMetrics is not completely transparent. Most notably, | |
// the values of "quantile" labels of Summaries and "le" labels of Histograms are | |
// formatted with a trailing ".0" if they would otherwise look like integer numbers | |
// (which changes the identity of the resulting series on the Prometheus | |
// server). | |
// | |
// See other options in OpenMetricsOptions to learn how to enable some special | |
// features e.g. potentially dangerous created timestamp series. |
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.
// The main reason for enabling OpenMetrics Text was to enable exemplars,
// but Prometheus proto has that as feature as well.
this part seems a bit out of place, not adding much to the comment 🤔, is it ok to not add this part?
prometheus/promhttp/http.go
Outdated
// is recommended to enable the feature flag in Prometheus, otherwise enabling | ||
// _created lines will result in increased cardinality and no improvements | ||
// in reset detection. | ||
EnableOpenMetricsCreatedMetrics bool |
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.
EnableOpenMetricsCreatedMetrics bool | |
EnableCreatedSeries bool |
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.
Hmmmmm, future versions of OM might not expose them as a series. What do you think about EnableCreatedTimestamps
?
e9c6f77
to
81909c5
Compare
We need prometheus/common v0.49.0 for this feature, but this version of prometheus/common requires go 1.21. Therefore, the PR is blocked until we drop support for go 1.20 |
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
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
Signed-off-by: Arthur Silva Sens <arthur.sens@coralogix.com>
81909c5
to
65df2d7
Compare
After quite some work to unblock this, this is finally ready :) Do you want to review again or should I just merge? |
This PR adds an extra option to print _created lines when OpenMetrics is the chosen exposition format. It's implemented following the conditional option added in prometheus/common#504.