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

ConstLabels not included in upMetric #95

Closed
robert-toth opened this issue Apr 17, 2020 · 6 comments · Fixed by #96 or #97
Closed

ConstLabels not included in upMetric #95

robert-toth opened this issue Apr 17, 2020 · 6 comments · Fixed by #96 or #97

Comments

@robert-toth
Copy link

Describe the bug
Not sure this is a bug or intentionally omitted, but const labels are not attached to the upMetric while it is present on all other metrics.
For the use case of my team we want to show, in Grafana, the number of pods that are up and running and also the version of our build being served by the Nginx in those pods. The number of pods we get by just summing the upMetric but we don't get the version because that is not included in the upMetric

To reproduce
Steps to reproduce the behavior:

  1. Run the nginx-prometheus-exporter docker container with CONST_LABELS env. variable set to version=1.2.1
  2. Visit the /metrics url to get a list of all the metrics
  3. Compare one of the stub_stats metrics with the upMetric and verify that version=1.2.1 is returned by the stub_stats metrics but not the upMetric

Expected behavior
I'd like the upMetric to include const labels just lite the stub_stats metrics

Your environment

  • Version of the Prometheus exporter: 0.6.0 release
  • Version of Kubernetes: v1.11.0+d4cacc0
  • [if applicable] Kubernetes platform: OpenShift v3.11.135
  • Using NGINX

Additional context
image

@Dean-Coakley
Copy link
Contributor

Hi @robert-toth,

Thanks for including some details on your use case, this case wasn't considered.
We'll take a look shortly.

Perhaps in the meantime you can set your label directly by configuring it directly in your prometheus.yaml instead of using constLabels.
Example: https://prometheus.io/docs/prometheus/latest/getting_started/#configuring-prometheus-to-monitor-the-sample-targets

The label won't be present in /metrics but will be available in Prometheus. Will that work for you?

@robert-toth
Copy link
Author

Thanks for the quick reply.
Actually I already "fixed" it in a fork. I can create a pull request, was just not sure if this was intentional or not.

@robert-toth
Copy link
Author

Verified in my environment with a local build of the fork where I implemented the changes in the PR
image

@Dean-Coakley Dean-Coakley linked a pull request Apr 17, 2020 that will close this issue
6 tasks
@robert-toth
Copy link
Author

@Dean-Coakley Thanks for the merge. Will there be a patch release any time soon? Just trying to decide if I should use my locally built docker image for now or wait for a new release.

@pleshakov
Copy link
Contributor

Hi @robert-toth

We will release 0.7.0 during the next two weeks. That will include your bug fix and #86 . Unfortunately, I can't provide any specific date.

@robert-toth
Copy link
Author

Thanks for the update @pleshakov

@lucacome lucacome mentioned this issue Apr 22, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants