Skip to content

fix: keep counting after remove() without labels - #2701

Open
sharanggupta wants to merge 1 commit into
prometheus:mainfrom
sharanggupta:remove-no-labels-data-point
Open

sharanggupta wants to merge 1 commit into
prometheus:mainfrom
sharanggupta:remove-no-labels-data-point

Conversation

@sharanggupta

Copy link
Copy Markdown
Contributor

A metric without labels caches its data point. remove() and removeIf() drop the data point but keep the cached reference, so after counter.remove() every later counter.inc() updates an orphan and the counter is exported as 0. clear() already resets the cache (#972); remove() and removeIf() now do the same. The two new StatefulMetricTest cases fail without the change.

A metric without labels caches its data point. remove() and removeIf()
dropped the data point but kept the cached reference, so later updates
went to an orphan and were never exported. clear() already resets the
cache.

Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>

This branch has not been deployed

No deployments
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.

1 participant