Skip to content
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

Use the same Help for metrics with and without labels #122

Conversation

pierresouchay
Copy link
Contributor

When metrics are pre-registered with Help and without labels,
when issuing metrics with labels, the help was filled with
the key_name.

But prometheus client enforces help to be consistent accross
several elements, so, it can break at Runtime if a metric
has been declared without its labels and later issued this metric
with labels.

In order to fix this, we store the help declared at startup for
each key, so, when declaring a metric with some labels, we try
to re-used pre-declared help for the metric.

It should fix the issue that appeared with Consul 1.9.x and
fix hashicorp/consul#9471

When metrics are pre-registered with Help and without labels,
when issuing metrics with labels, the help was filled with
the key_name.

But prometheus client enforces help to be consistent accross
several elements, so, it can break at Runtime if a metric
has been declared without its labels and later issued this metric
with labels.

In order to fix this, we store the help declared at startup for
each key, so, when declaring a metric with some labels, we try
to re-used pre-declared help for the metric.

It should fix the issue that appeared with Consul 1.9.x and
fix hashicorp/consul#9471
@pierresouchay
Copy link
Contributor Author

pierresouchay commented Jan 5, 2021

Hello @mkcp

Maybe you could have a look at this PR to fix hashicorp/consul#9303 and hashicorp/consul#9198

Thank you!

@mkcp
Copy link
Contributor

mkcp commented Jan 5, 2021

@pierresouchay Awesome!! Thank you for putting together a patch to address hashicorp/consul#9303. I've loaded this up on a local docker cluster and I can confirm that the warning messages at Consul startup and runtime are gone. Also, looking at metrics with dynamic labels - they are correctly batched with the correct metric name & help text. E.g. the path label here for consul_api_http.

Screen Shot 2021-01-05 at 3 06 44 PM

Copy link
Contributor

@mkcp mkcp left a comment

Choose a reason for hiding this comment

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

Looks great to me! Appreciate the tests as well

@pierresouchay
Copy link
Contributor Author

@mkcp So, we just need a Review + Merge + Tag/Release before submitting the patch in Consul, right?

@dnephin, or @banks maybe?

@banks banks merged commit 8ca742b into hashicorp:master Jan 6, 2021
@banks
Copy link
Member

banks commented Jan 6, 2021

LGTM, thanks Pierre!

@banks
Copy link
Member

banks commented Jan 6, 2021

I created v0.3.6

@pierresouchay
Copy link
Contributor Author

Thank you @banks !

Made the update in hashicorp/consul#9510

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.

Weird error at startup with Consul 1.9.1: error gathering metrics: 13 error(s) occurred
3 participants