Skip to content

Static labels disappear when being copied from one processor to another in a chain #12408

Description

@Elecon-rou

Bug Report

Describe the bug

When multiple labels metric processors are chained, upsert labels created by an earlier processor disappear.

The processor creates a new CMetrics context and copies the previous one with cmt_cat():

https://github.com/fluent/fluent-bit/blob/master/plugins/processor_labels/labels.c

cmt_cat() does not copy CMetrics static labels:

https://github.com/fluent/fluent-bit/blob/master/lib/cmetrics/src/cmt_cat.c

To Reproduce

test_metric{original="value"} 1
pipeline:
  inputs:
    - name: prometheus_scrape
      tag: test
      host: 127.0.0.1
      port: 9090

      processors:
        metrics:
          - name: labels
            upsert: "first one"
          - name: labels
            upsert: "second two"

  outputs:
    - name: prometheus_exporter
      match: test
      port: 2021

Expected

test_metric{original="value",first="one",second="two"} 1

Actual

test_metric{original="value",second="two"} 1

Your Environment

  • Version: 5.1-debug
  • Plugins: prometheus_scrape, labels, prometheus_exporter

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions