Skip to content

filter_logs_to_metrics: document field_value usage for counters#1584

Open
databus23 wants to merge 5 commits into
fluent:masterfrom
databus23:logs_to_metrics-pr-10055
Open

filter_logs_to_metrics: document field_value usage for counters#1584
databus23 wants to merge 5 commits into
fluent:masterfrom
databus23:logs_to_metrics-pr-10055

Conversation

@databus23
Copy link
Copy Markdown

@databus23 databus23 commented Mar 10, 2025

This documents a feature added with this PR: fluent/fluent-bit#10055

Summary by CodeRabbit

  • Documentation
    • Added a new derived counter metric, "total_duration", sourced from the duration field and documented with a description.
    • Updated Prometheus sample output to include the new metric and adjusted sample values for existing counter examples.

Review Change Stack

This documents a feature added with this PR: fluent/fluent-bit#10055

Signed-off-by: Fabian Ruff <fabian.ruff@sap.com>
Copy link
Copy Markdown
Member

@alexakreizinger alexakreizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @databus23, thanks for submitting a docs PR! I just suggested a few edits for clarity and consistency.

Comment thread pipeline/filters/log_to_metrics.md Outdated
Comment thread pipeline/filters/log_to_metrics.md Outdated
Comment thread pipeline/filters/log_to_metrics.md Outdated
Comment thread pipeline/filters/log_to_metrics.md Outdated
Co-authored-by: Alexa Kreizinger <alexakreizinger@gmail.com>
Signed-off-by: Fabian Ruff <fabian@progra.de>
@databus23
Copy link
Copy Markdown
Author

@alexakreizinger thanks for the feedback. I merged in all your suggestions.

Copy link
Copy Markdown
Member

@alexakreizinger alexakreizinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thank you :) I'm approving this, but I won't merge anything since it sounds like we're still waiting on a different code PR—feel free to merge this one when the time comes.

@lecaros lecaros added waiting-for-user Waiting for user/contributors feedback or requested changes conflict Waiting on conflict to be resolved by contributor labels May 30, 2025
@eschabell
Copy link
Copy Markdown
Collaborator

@databus23 can you resolve the conflicts please as I've also nudged the review on code PR fluent/fluent-bit#10055, so I can merge this when it's ready?

@eschabell eschabell self-assigned this Oct 21, 2025
@esmerel
Copy link
Copy Markdown
Contributor

esmerel commented Oct 21, 2025

The conflicts were due to formatting changes for style, I went ahead and fixed the conflicts in the interest of keeping things moving.

@esmerel esmerel removed conflict Waiting on conflict to be resolved by contributor waiting-for-user Waiting for user/contributors feedback or requested changes labels Oct 21, 2025
@eschabell eschabell added 4.2.1 and removed 4.2.1 labels Dec 3, 2025
Signed-off-by: Lynette  Miles <6818907+esmerel@users.noreply.github.com>
Signed-off-by: Eric D. Schabell <eric@schabell.org>
@eschabell eschabell force-pushed the logs_to_metrics-pr-10055 branch from 347ee6f to 15ea4a6 Compare May 28, 2026 11:09
@eschabell eschabell self-requested a review as a code owner May 28, 2026 11:09
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

Documentation for the Fluent Bit log_to_metrics filter is updated: the Counter example now defines a second counter metric total_duration (using value_field: duration), the fluent-bit example snippets add the Value_Field duration directive, and the Prometheus /metrics sample output reflects the new metric and adjusted values.

Changes

log_to_metrics Counter Example

Layer / File(s) Summary
Counter metric example with total_duration metric
pipeline/filters/log_to_metrics.md
Fluent Bit config examples extended to add a total_duration counter metric with metric_name, metric_description, and value_field: duration. Example fluent-bit.conf snippet adds Value_Field duration. The Prometheus /metrics example includes the new log_metric_counter_total_duration metric and adjusted sample values for the existing counter.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I’m a rabbit in the logs, I hop and tally through the night,
Two counters now I nibble on, one sums duration’s flight,
Prometheus peeks and writes the totals in a row,
Docs now whisper how to count the time that logs bestow,
Hop, update, publish—metrics bloom in gentle light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: documenting field_value usage for counters in the filter_logs_to_metrics component, which aligns with the PR's objective to document a feature from fluent-bit PR #10055.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
pipeline/filters/log_to_metrics.md (1)

155-155: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix typo in metric HELP text.

time spend should be time spent to match the configured description and avoid confusion.

Suggested fix
-# HELP log_metric_counter_total_duration This metric counts the total time spend
+# HELP log_metric_counter_total_duration This metric counts the total time spent
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pipeline/filters/log_to_metrics.md` at line 155, Update the HELP text for the
Prometheus metric named log_metric_counter_total_duration to correct the typo
"time spend" → "time spent" (edit the HELP line in
pipeline/filters/log_to_metrics.md so the description matches the configured
description and reads "This metric counts the total time spent").
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pipeline/filters/log_to_metrics.md`:
- Around line 110-117: The YAML/classic examples are out of sync: add the same
counter configuration shown in the fluent-bit.conf example to the
fluent-bit.yaml/classic example so outputs match; specifically ensure the filter
named log_to_metrics includes metric_mode: counter, metric_name: total_duration,
metric_description and value_field: duration (mirror the total_duration counter
definition present in the conf example) so the sample output lines that show
both counters are reproducible.

---

Duplicate comments:
In `@pipeline/filters/log_to_metrics.md`:
- Line 155: Update the HELP text for the Prometheus metric named
log_metric_counter_total_duration to correct the typo "time spend" → "time
spent" (edit the HELP line in pipeline/filters/log_to_metrics.md so the
description matches the configured description and reads "This metric counts the
total time spent").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a696f61e-a519-4fa9-b060-95895dacadbc

📥 Commits

Reviewing files that changed from the base of the PR and between cab5957 and 15ea4a6.

📒 Files selected for processing (1)
  • pipeline/filters/log_to_metrics.md

Comment thread pipeline/filters/log_to_metrics.md Outdated
…ounter examples

  - Add total_duration counter filter to fluent-bit.yaml example to match
    fluent-bit.conf
  - Fix indentation in second [FILTER] block from 4-space to 2-space
  - Apply Title_Case to all keys in the classic conf counter example

  Applies to fluent#1584

Signed-off-by: Eric D. Schabell <eric@schabell.org>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Signed-off-by: Eric D. Schabell <eric@schabell.org>
Copy link
Copy Markdown
Collaborator

@eschabell eschabell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@databus23 waiting now on code PR merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants