Skip to content

stats: envoy prometheus endpoint fails promlint due to format issue #3019#3049

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
pitiwari:prom_issue_3019
Apr 11, 2018
Merged

stats: envoy prometheus endpoint fails promlint due to format issue #3019#3049
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
pitiwari:prom_issue_3019

Conversation

@pitiwari
Copy link
Copy Markdown
Contributor

@pitiwari pitiwari commented Apr 10, 2018

Fix Envoy route config name for Prometheus metrics

Description: Fixes #3019
Need to move route config name as part of Prometheus metrics label
Prometheus fails to scrap data because of format incompatibility. Having "-" in the tag value causes the failure.

Risk Level: Low

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tiny nit since you need to fix DCO anyway. Also, please mark "Fixes " in the PR description so the issue this is fixing will auto close. Thanks!

Comment thread test/server/http/admin_test.cc Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This comment can be on a single line, start with capital ("If") and end with a period.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@pitiwari pitiwari changed the title stats: envoy prometheus endpoint fails promlint due to format issue #… stats: envoy prometheus endpoint fails promlint due to format issue #3019 Apr 10, 2018
@pitiwari pitiwari changed the title stats: envoy prometheus endpoint fails promlint due to format issue #3019 stats: envoy prometheus endpoint fails promlint due to format issue fixes #3019 Apr 10, 2018
@pitiwari pitiwari changed the title stats: envoy prometheus endpoint fails promlint due to format issue fixes #3019 stats: envoy prometheus endpoint fails promlint due to format issue #3019 Apr 10, 2018
Comment thread test/server/http/admin_test.cc Outdated
}

TEST(PrometheusStatsFormatter, FormattedTags) {
// If value has - then it should be replaced by - .
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean s/-/_ for the last one?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. please let me know if you want any changes in this comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change the comment to be accurate. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed

Signed-off-by: pitiwari <pitiwari@ebay.com>
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@mattklein123 mattklein123 merged commit c2751df into envoyproxy:master Apr 11, 2018
@JonathanO
Copy link
Copy Markdown
Contributor

JonathanO commented Jul 10, 2018

Hi,
The referenced issue, #3019, provides a case that shows that a "-" in the metric NAME failed promlint, and that was probably fixed in #2303.
This PR, however, changes the metric label VALUE (so it has no bearing on #3019!) According to the Prometheus spec (https://prometheus.io/docs/concepts/data_model/) any unicode char is valid inside the label and so this change is not necessary (it's also a breaking change for us (yes, I need to get better at following master!))

Is there any reason not to revert this?

JonathanO added a commit to JonathanO/envoy that referenced this pull request Jul 10, 2018
… issue envoyproxy#3019 (envoyproxy#3049)"

This reverts commit c2751df.

Prometheus label values are permitted to contain any Unicode char. The
original bug (envoyproxy#3019) was due to metric names not being sanitized, which
was resolved by envoyproxy#2303. Change envoyproxy#3049 was therefore unnecessary and
leads to an unexpected change in label values.

Signed-off-by: Jonathan Oddy <jonathan.oddy@transferwise.com>
htuch pushed a commit that referenced this pull request Jul 10, 2018
… issue #3019 (#3049)" (#3830)

This reverts commit c2751df.

The originally reported bug (#3019) was due to metric names not being sanitized, which I think was resolved by #2303.
Change #3049, which was intended to fix #3019, erroneously applied sanitization to label values instead. Prometheus label values are permitted to contain any Unicode char, so this change was unnecessary and leads to an unexpected change in e.g. cluster names.

This PR reverts the change, so that - and . will be preserved in label values.

Risk Level: low

Signed-off-by: Jonathan Oddy <jonathan.oddy@transferwise.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants