Don't zero out Gauges. - #813
Open
jdmarshall wants to merge 2 commits into
Open
Conversation
Signed-off-by: Jason Marshall <jdmarshall@users.noreply.github.com>
Also does some lifecycle work for how and when stores are initialized, in preparation for more extensive changes for prometheus#812 Fixes prometheus#622 Signed-off-by: Jason Marshall <jdmarshall@users.noreply.github.com>
jdmarshall
commented
Aug 21, 2026
|
|
||
| ### Added | ||
|
|
||
| ## [0.16.0] - 2026-08-?? |
Contributor
Author
There was a problem hiding this comment.
This got picked up from another PR that needs to land for v0.16.0
jdmarshall
commented
Aug 21, 2026
| throw new Error('Optional "collect" parameter must be a function'); | ||
| } | ||
|
|
||
| if (this.labelNames) { |
Contributor
Author
There was a problem hiding this comment.
So my IDE is telling me we don't use these values anymore, and with the LabelMap call right below this (which also does this sort) and the deprecations in util.js, it's looking more and more like we can just drop these. Which would also be a little more memory for #800
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR started as exploratory work for a different issue - there's been a TODO that I added to metric.js that fights the work needed for #812. I had already decided that doing #812 all in a single PR would probably get a little bit on the long side, so I was looking for some stopping point in the middle to split it up.
I noticed that if #622 were fixed, then a default
reset()implementation would be used by 2 of the 4 builtin metric types.This PR initializes the store in metrics.js, and then retains the LabelMap object across
reset()calls, and removes the zeroing logic fromGauge.reset(), thereby fixing #622.