-
Notifications
You must be signed in to change notification settings - Fork 304
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
HPCC-31227 Address Prometheous histogram issues #18293
HPCC-31227 Address Prometheous histogram issues #18293
Conversation
- Fixes invalid quote on le=+Inf bucket - Qualifies sum and count w/ metric name - Normalizes all names to lowercase per promtool suggestion Signed-off-by: Rodrigo Pastrana <[email protected]>
https://track.hpccsystems.com/browse/HPCC-31227 |
@ghalliday targeting latest point branch, but it seems this feature has been broken since its inception (#16624) which seems to have been included as far back as 8.12.x |
@@ -180,6 +180,9 @@ void PrometheusMetricSink::toPrometheusHistogram(const std::string &name, const | |||
std::string PrometheusMetricSink::getPrometheusMetricName(const std::shared_ptr<IMetric> &pMetric) | |||
{ | |||
std::string name = pMetric->queryName(); | |||
// Convert to lower case - per promtool output: "metric names should be written in 'snake_case' not 'camelCase'" |
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.
Perhaps out of scope of this issue, but lower casing all metric names per Prometheus promtool output:
dfs_8880_WsDfs_KeepAlive_seconds metric names should be written in 'snake_case' not 'camelCase'
dfs_8880_WsDfs_KeepAlive_seconds no help text
@@ -240,16 +243,16 @@ const std::vector<std::string> &PrometheusMetricSink::getHistogramLabels(const s | |||
|
|||
// Add the inf label | |||
std::string infLabel(name); | |||
infLabel.append("_bucket{\"le=+Inf\"}"); | |||
infLabel.append("_bucket{le=\"+Inf\"}"); |
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.
Incorrect double quote location
labels.emplace_back(infLabel); | ||
|
||
// Sum and count | ||
std::string sumLabel; | ||
sumLabel.append("_sum"); | ||
std::string sumLabel(name); |
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.
_sum and _count missing metric name prefix
std::string countLabel; | ||
countLabel.append("_count"); | ||
std::string countLabel(name); | ||
countLabel.append("_count{}"); |
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.
Curious why the '{}" is present. Braces are not part of what is shown on the Prometheus page documenting their exposition formats. See https://prometheus.io/docs/instrumenting/exposition_formats/
Please double check the reason for "{}" in both places where added
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.
Great observation, it's legal syntax as confirmed by promtool and prometheous graph UI used as a label container. It's optional, and honestly it was added as I tested why your histograms were deemed invalid.
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.
What stands out to me is the fact there's currently no mechanism (at least not one I could see) to populate the histogram buckets w/ any available metadata as labels. That will likely need to be fixed.
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.
Based on comment that promtool accepted the {} appended to the histogram sum and count outputs.
@ghalliday please merge. Currently targeting 9.4.x, but not sure if we should back port. This fixes a feature introduced in 8.12.x but to the best of my knowledge it never worked quite right for Prometheus |
Type of change:
Checklist:
Smoketest:
Testing: