Conversation
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.
Problem encountered:
When a metric's label schema changes (e.g., adding a new label to an existing counter), the Redis storage adapters s
ilently keep the old
__meta, causing a fatalValueErroron the next render.Root cause:
updateCounter()only writes__metawhensAddreturns1(first registration). On subsequent writes, even with a different label set ,
sAddreturns0and__metais skipped:updateGauge()has an equivalent guard that checkshSet/hIncrByFloatreturn values.updateHistogram()does not have this problem, it writes__metaunconditionally on every call.When old-schema samples coexist with new-schema samples in the same hash,
RenderTextFormat::escapeAllLabels()calls
array_combine()with mismatched array lengths →ValueErrorthat kills the entire scrape, not just the affected metric.
This is a production issue for any application that changes metric labels across deployments (rolling updates, canar
y releases, feature flags). Fixes #147, fixes #179.
Reproduction:
['foo']['foo', 'bar']and incrementcollect()→__metastill says['foo']while the hash contains a['val1', 'val2']sampleRenderTextFormat::render()→ValueError: array_combine()Proposed solution:
Remove the conditional gates on
__metawrites inupdateCounter()andupdateGauge()for bothAbstractRedisand
RedisNg, making them unconditional, matchingupdateHistogram()'s existing behavior.