Skip to content

Opentelemetry - Attributes array not supported for metric gauges #11045

@nortenorte

Description

@nortenorte

Bug Report

Describe the bug
Fluent-bit does not process opentelemetry array attribute.

Opentelemetry specification for attributs.
https://opentelemetry.io/docs/specs/otel/common/#attribute

To Reproduce
Run python script which sends a metric with attributes containing arrays to fluentbit and let fluentbit send them to otel collector.

Start otel-collector (https://github.com/open-telemetry/opentelemetry-collector) listening to OTLP on port 4319.

Run Fluent-bit 4.1.1 with this configuration:

service:
  log_level: trace 

pipeline:
  inputs:
    - name: opentelemetry
      tag: input_open
      listen: 127.0.0.1
      http2: Off
      port: 4318
      successful_response_code: 200
  outputs:
    - name: opentelemetry
      host: 127.0.0.1
      http2: Off
      port: 4319
      match: '*'

Install python SDK and API according to: https://github.com/open-telemetry/opentelemetry-python.

from opentelemetry import metrics
from opentelemetry.metrics import Observation, CallbackOptions
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter

exporter = OTLPMetricExporter(
    endpoint="http://localhost:4318/v1/metrics",
)

reader = PeriodicExportingMetricReader(exporter, export_interval_millis=1)
provider = MeterProvider(metric_readers=[reader])
metrics.set_meter_provider(provider)
meter = metrics.get_meter("meter")

def callback(options: CallbackOptions):
    yield Observation(
        value=10,
        attributes={
            "int_array": (1, 2, 3, 4, 5),
            "double_array": (1.1, 2.2, 3.3, 4.4, 5.5),
            "bool_array": (True, False, True, False, True),
            "string_array": ("One", "Two", "Three", "Four", "Five"),
        }
    )

meter.create_observable_gauge(
    name="metric_gauge",
    callbacks=[callback],
    unit="unit",
    description="Meter description",
)

No output to otel collector.

Error message in fluent-bit log.

[2025/10/20 08:27:49.342324039] [trace] [input:opentelemetry:opentelemetry.0 at /fluent-bit/plugins/in_opentelemetry/opentelemetry.c:53] new TCP connection arrived FD=35
[2025/10/20 08:27:49.342375546] [trace] [input:opentelemetry:opentelemetry.0 at /fluent-bit/plugins/in_opentelemetry/http_conn.c:114] read()=663 pre_len=0 now_len=663
[2025/10/20 08:27:49.342833977] [trace] [input:opentelemetry:opentelemetry.0 at /fluent-bit/plugins/in_opentelemetry/http_conn.c:109] fd=35 closed connection
[2025/10/20 08:27:50.47041537] [debug] [task] created task=0x75c7e8030750 id=0 OK
[2025/10/20 08:27:50.47210503] [debug] [output:opentelemetry:opentelemetry.0] cmetrics msgpack size: 599
[2025/10/20 08:27:50.47385325] [error] [output:opentelemetry:opentelemetry.0] Error decoding msgpack encoded context
[2025/10/20 08:27:50.47439251] [debug] [out flush] cb_destroy coro_id=0
[2025/10/20 08:27:50.47455544] [debug] [task] destroy task=0x75c7e8030750 (task_id=0)

Expected behavior
Expected the otel-collector to receive the otel message with array attribute.

Below is the output from otel-collector when running above python script without fluentbit in between, expecting to get the same when using fluentbit.

2025-10-20T08:27:06.640+0200    info    Metrics {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2025-10-20T08:27:06.640+0200    info    ResourceMetrics #0
Resource SchemaURL: 
Resource attributes:
     -> telemetry.sdk.language: Str(python)
     -> telemetry.sdk.name: Str(opentelemetry)
     -> telemetry.sdk.version: Str(1.38.0)
     -> service.name: Str(unknown_service)
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope meter 
Metric #0
Descriptor:
     -> Name: metric_gauge
     -> Description: Meter description
     -> Unit: unit
     -> DataType: Gauge
NumberDataPoints #0
Data point attributes:
     -> int_array: Slice([1,2,3,4,5])
     -> double_array: Slice([1.1,2.2,3.3,4.4,5.5])
     -> bool_array: Slice([true,false,true,false,true])
     -> string_array: Slice(["One","Two","Three","Four","Five"])
StartTimestamp: 1970-01-01 00:00:00 +0000 UTC
Timestamp: 2025-10-20 06:27:06.602265704 +0000 UTC
Value: 10
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}

Screenshots

Your Environment
Ubuntu x86_64
Fluentbit 4.1.1 (default build configuration)

Additional context
We want to send attributes arrays with metric gauges.

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