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

Add function for setting a Histogram to zero for given labels #386

Merged
merged 1 commit into from
Feb 1, 2021

Conversation

lukasstockner
Copy link
Contributor

Since PR #139, histograms are initialized to zero if they do not use any labels - however, there currently is no way to do the same for histograms with labels (without directly accessing the internals of the histogram from the outside, which is of course not a great solution).

Therefore, this PR adds a function that lets the user explicitly zero out the metrics for given labels. Since prom-client has no way of knowing what the values of the labels can be, it's up to the user to call this with all expected values.

@zbjornson zbjornson linked an issue Jan 23, 2021 that may be closed by this pull request
Copy link
Collaborator

@zbjornson zbjornson left a comment

Choose a reason for hiding this comment

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

Excellent, thank you, this will fix #409. A few quick requests - can you please:

  • Add the new function to index.d.ts
  • Add a short mention in the readme
  • Rebase on master

If you don't have time or I don't hear back in a few days, I can make these changes.

Copy link
Collaborator

@zbjornson zbjornson left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@zbjornson zbjornson merged commit 96f7495 into siimon:master Feb 1, 2021
@mkreidenweis-schulmngr
Copy link

I'd love to use this. Unfortunately it's not on npm yet.
@siimon @zbjornson Any chance this will be released soon? Can I help somehow? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initializing labeled histograms
3 participants