-
Notifications
You must be signed in to change notification settings - Fork 1.8k
input_metrics: discard cmetrics with no series #10700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
92d0cbe
macros: use stdbool for booleans
edsiper e65b7b9
metrics: add flb_metrics_is_empty() helper
edsiper 943639d
input_metric: drop metrics with empty data series
edsiper 1bbf67c
output: discard metrics with empty data series
edsiper c9ced09
output: safe cleanup on metricsprocessors failure
edsiper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard against NULL input in
flb_metrics_is_empty()
If a caller ever passes a
NULL
struct cmt *
, the function will seg-fault.A defensive early-return costs nothing and prevents a crash path that’s very hard to diagnose at runtime.
📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
FLB_TRUE
insteadtrue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 173
🏁 Script executed:
Length of output: 56
🏁 Script executed:
Length of output: 74
@edsiper, you're right! For consistency with the rest of the codebase, here's the updated suggestion using
FLB_TRUE
:This maintains consistency with the project's macro usage pattern, even though
FLB_TRUE
is now defined as the boolean literaltrue
.🧬 Code Graph Analysis Results
Relevant snippets from
src/flb_metrics.c
(lines 22-35)FLB_TRUE
if the ID exists, otherwiseFLB_FALSE
.FLB_TRUE
instead oftrue
is directly relevant here since this function returnsFLB_TRUE
andFLB_FALSE
macros instead of standard Ctrue
/false
.Relevant snippets from
src/flb_metrics.c
(lines 37-51)FLB_TRUE
andFLB_FALSE
macros for boolean logic.FLB_TRUE
instead oftrue
is relevant.Relevant snippet from
include/fluent-bit/flb_mem.h
(lines 84-96)flb_calloc
function used inflb_metrics_create
for memory allocation.Relevant snippet from
src/flb_sds.c
(lines 389-399)flb_sds_destroy
frees string data structures used for metric titles.flb_metrics_destroy
.Relevant snippet from
src/flb_sds.c
(lines 58-76)flb_metrics_add
andflb_metrics_title
.Relevant snippet from
lib/cmetrics/src/cmt_counter.c
(lines 26-81)flb_metrics.c
for attaching metrics.attach_uptime
.Relevant snippet from
lib/cmetrics/src/cmt_gauge.c
(lines 27-81)flb_metrics.c
for attaching metrics like process start time and build info.Relevant snippet from
lib/cmetrics/src/cmt_gauge.c
(lines 94-109)CMT_TRUE
macro for boolean.[End of relevant snippets.]