Repository navigation
Support exemplars in multiprocess mode - #1265
Open
vignesh2027 wants to merge 1 commit into
Open
vignesh2027 wants to merge 1 commit into
vignesh2027 wants to merge 1 commit into
Conversation
Counter.inc and Histogram.observe accepted an exemplar in multiprocess mode but dropped it, so nothing was ever exposed for it. This was left as a TODO in MmapedValue. Each process now keeps its exemplars in a counter_<pid>.exemplars or histogram_<pid>.exemplars file next to its .db files. Every series gets one fixed size slot, written once and then replaced in place, so the file does not grow with the number of exemplars. A sequence number lets the collector skip a slot that is being rewritten while it reads it. MultiProcessCollector picks up the *.exemplars files and, for every series, exposes the exemplar with the newest timestamp across processes. The extension keeps older collectors from mistaking the new files for metric files during a rolling upgrade. Signed-off-by: vigneshwar <applemacbook6sep2004@gmail.com>
This branch has not been deployed
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.
Fixes #826
Exemplars passed to
Counter.incandHistogram.observewere silently dropped in multiprocess mode, becauseMmapedValue.set_exemplarandget_exemplarwere stubs. The docs listed exemplars as unsupported there.This follows the second option csmarchbanks described in the issue, a separate set of exemplar files so the existing
.dbfiles stay as they are. Each process writescounter_<pid>.exemplarsandhistogram_<pid>.exemplarslazily, on the first exemplar. A series gets one fixed size slot that is replaced in place, so the files do not grow with the number of exemplars. The labels are stored as JSON in the slot, sized for the 128 character limit. A sequence number lets the collector skip a slot that is being rewritten while it reads.MultiProcessCollectorglobs the*.exemplarsfiles next to the.dbfiles and, for every series, exposes the exemplar with the newest timestamp across processes. For histograms that is per bucket, as in single process mode. The different extension means older collectors never treat the new files as metric files during a rolling upgrade, andmerge()accepts them in the same file list.Tests cover counters and histograms across processes, newest wins, no growth on repeated writes, non-ASCII and maximum size labels, fork handling, a missing file during merge, and the slot format itself, including a half written slot. The new tests fail on master and pass here. flake8 and the full suite are clean.
Signed off under the DCO. The change is above the trivial size, so I am happy to take the design to the mailing list first if that is preferred.