Repository navigation
storage: test that checkWriteRequest does not format metric families - #866
Merged
jan--f merged 1 commit intoOct 8, 2026
Merged
Conversation
KR-Ravindra
marked this pull request as ready for review
September 14, 2026 07:51
Contributor
Author
|
Two weeks without a reviewer, so a short ping. This bumps prometheus/common to v0.71.0, which includes prometheus/common#960 where |
KR-Ravindra
force-pushed
the
fix/nop-logger-formats-metric-families
branch
from
October 6, 2026 10:29
46e678b to
b9ddd8b
Compare
checkWriteRequest runs the consistency check on a scratch DiskMetricStore with promslog.NewNopLogger(). Up to prometheus/common v0.70.x that logger was a TextHandler writing to io.Discard whose Enabled() returned true, so the Info calls in processWriteRequest and GetMetricFamilies that pass whole *dto.MetricFamily values as attributes serialized every metric of the affected families on every push, even with --log.level=warn. Push latency therefore scaled with the size of the store whenever any stored metric family had an inconsistent help string. prometheus/common v0.71.0 (prometheus/common#960) makes NewNopLogger return a disabled slog.DiscardHandler; master picked that version up in prometheus#871. Add a regression test that checks a push against a 1000-metric family with an inconsistent help string does not allocate more than a push with a consistent one. Signed-off-by: KR Ravindra <42912207+KR-Ravindra@users.noreply.github.com>
KR-Ravindra
force-pushed
the
fix/nop-logger-formats-metric-families
branch
from
October 6, 2026 10:29
b9ddd8b to
da4bc00
Compare
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
Since Pushgateway 1.11 switched to
promslog, push latency grows with the size of the store as soon as any stored metric family has an inconsistent help string, even with--log.level=warn(#863: ~63% of CPU inslog.(*TextHandler).HandleundercheckWriteRequest).checkWriteRequestruns the consistency check on a scratchDiskMetricStorewithpromslog.NewNopLogger(). Up toprometheus/commonv0.70.x that logger is aTextHandlerwriting toio.DiscardwhoseEnabled()returns true, so theInfocalls inprocessWriteRequestandGetMetricFamiliesthat pass whole*dto.MetricFamilyvalues as attributes serialize every metric of the affected families on every push.Fix
prometheus/commonv0.71.0 (prometheus/common#960) makesNewNopLoggerreturn a disabledslog.DiscardHandler. master picked that version up in #871, so this PR is now only the regression test:TestCheckWriteRequestInconsistentHelpAllocspushes one metric against a stored 1000-metric family and asserts that an inconsistent help string does not cost more allocations than a consistent one. It fails on v0.69.0 (34115 extra allocations) and passes on master.Fixes #863
This change was prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it.