Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Import fluent/cmetrics commit bf85d9ebccb6e4c4e34b8c8574281440dc28530b. Copy static labels across contexts, deduplicate matching labels, and reject conflicting static values or destination metric label keys before appending. Include the upstream API contract and regression tests. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
cosmo0920
force-pushed
the
cosmo0920-canary-plugging-issue-of-missing-static-labels-on-concatenation
branch
from
September 16, 2026 06:21
4b12774 to
c22ce3a
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.
This PR is depending on fluent/cmetrics#302.
Also, added runtime tests and integration tests.
The root cause of this issue is:
Confirmed: the labels processor treats
cmt_cat()as a full context clone, but it does not preserve context-level static labels. The local binary reproduces your result.The failure path is:
original="value"is stored as a per-series label.upsertsees thatfirstis absent from the dynamic labels and adds it tocmt->static_labels. See upsert_labels().cmt_cat(out_cmt, metrics_context). See cb_process_metrics() line 1858.src->static_labels. Thusoriginalsurvives andfirstdisappears before the second processor applies its operations.second="two"to its new context.Observed results:
The last case establishes that this affects any subsequent labels processor, even one that only updates an unrelated label.
The focused fix would be to deep-copy the incoming static labels into the new context before applying label operations, with allocation-failure cleanup. Changing
cmt_cat()globally needs more consideration: it also merges contexts, and adding source labels globally could apply them to unrelated destination metrics.Existing coverage misses this because the upsert test configures multiple operations on a single processor.
Verification:
ctest --test-dir build -R processor_labels --output-on-failure— passed.MEMCHECK=1 python3 /tmp/repro_labels_chain.py— reproduced the same results under Valgrind. Memory check failed in the two chained cases, reporting DNS lookup and input-coroutine leaks at shutdown; those stacks do not establish a connection to the label-copy defect.Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.