fluent / fluent/fluent-bit

[log_to_metrics] add_label adds a dimension just like label_field, producing duplicate metrics

Open
#12,107 0 comments 0 reactions 0 assignees View on GitHub
status: waiting-for-triage
Dominant language
C
Stars
8.1k
Forks
2k
Avg merge
4d 16h
Merged PRs (30d)
58

Description

how to reproduce
```
[SERVICE]
flush 1
log_level info

[INPUT]
Name dummy
Dummy {"block_device":"vda", "used_percent":"0.01"}
Tag log.io

[INPUT]
Name dummy
Dummy {"block_device":"vdb", "used_percent":"0.02"}
Tag log.io

[FILTER]
name log_to_metrics
match log.io
tag metric.io
metric_mode gauge
metric_name used_percent
value_field used_percent
metric_description disk i/o
add_label block_device block_device

[OUTPUT]
name stdout
match log.io

[OUTPUT]
name stdout
match metric.io
```
result is
```
[0] log.io: [[1784185288.876221477, {}], {"block_device"=>"vda", "used_percent"=>"0.01"}]
[0] log.io: [[1784185288.876303412, {}], {"block_device"=>"vdb", "used_percent"=>"0.02"}]
2026-07-16T07:01:28.876267678Z log_metric_gauge_used_percent{block_device="vda"} = 0.01
2026-07-16T07:01:27.876286303Z log_metric_gauge_used_percent{block_device="vdb"} = 0.02
2026-07-16T07:01:28.876267678Z log_metric_gauge_used_percent{block_device="vda"} = 0.01
2026-07-16T07:01:28.876310684Z log_metric_gauge_used_percent{block_device="vdb"} = 0.02
```
seems like a bug to me. or is that normal?

Contributor guide

Open the contributing guide

Research direction

Start by running the provided configuration and tracing the log_to_metrics filter, focusing on how add_label and label_field are handled. Done means the reproduction emits one metric per input record rather than duplicate metrics with the same block_device label.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.