fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

OpenTelemetry Plugins should have a way to modify Resource and Scope

Open braydonk opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. Resource Attributes in OTLP are used to identify logs with a particular resource, making them very important for an OTLP exporter to be able to modify. Today, there is no way to add Resource Attributes, but this is very common in OTLP pipelines and is crucial for making OTLP useful for more cases in Fluent Bit.
Scope is not quite as crucial as Resource, but it would still make sense to allow access to that too.

Describe the solution you'd like Something similar to add_label could work. add_resource_attribute perhaps. I think that would still be too limiting though, and the best possible solution is allowing a way to operate on resource in all the standard field modification operations.

With Scope, it would make sense to actually instrument a Fluent Bit scope, so that downstream consumers will be able to tell that the data was produced by a Fluent Bit agent. Other than that, the same solution as Resource should be available for Scope too.

Describe alternatives you've considered

N/A

Additional context

To make Fluent Bit as useful as possible for OTLP pipelines, it really should be able to operate on Resource and Scope just like the OpenTelemetry Collector can. See also #8205, which is actually a bug particular to logs that definitely makes Fluent Bit hard to use for this case.

braydonk avatar Nov 20 '23 22:11 braydonk

Totally agree with this feature request. Do we any plan on this?

The current workaround is to setup an intermediate opentelemetry collector between fluent-bit and the final opentelemetry collector and configure the resource processor on this intermediate opentelemetry collector to add resource attributes. This obviously makes things complicated.

liji-canva avatar Jan 04 '24 23:01 liji-canva

What about altering syntax of add_label to be following for out:opentelemetry?

add_label            label_name label_value resource|scope ?

Would be happy to raise a PR if this will get approved

SHaaD94 avatar Jan 10 '24 05:01 SHaaD94

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

github-actions[bot] avatar Apr 11 '24 01:04 github-actions[bot]

This is still relevant.

braydonk avatar Apr 11 '24 01:04 braydonk

It is relevant

There is also a use case in which fluent-bit collects metrics from all kinda source on a "device" with a unique ID. Instead of all programs separately declares the same resource attribute, like "service.instance.id", Fluent-Bit could add this attribute value to all Spans/Log/Metrics it collects before it outputs them to a remote OpenTelemetry Collector.

shaohme avatar May 07 '24 12:05 shaohme

FYI: Opentelemetry Logs resource and scope handling is done through #8989

edsiper avatar Jun 21 '24 12:06 edsiper

https://github.com/fluent/fluent-bit/pull/8989 merged

edsiper avatar Jun 24 '24 19:06 edsiper

#8989 merged

Nice to see it implemented for logs :+1: but shouldn't we close the issue when support for metrics and spans have been implemented too?

shaohme avatar Jun 25 '24 05:06 shaohme

Yes, appreciate the work on logs, is there an open ticket for metrics and traces resource attribute modification support?

Brodiemm avatar Aug 06 '24 23:08 Brodiemm