Opentelemetry: OTLP metric exported to cloudwatch but with empty Namespace
Bug Report
Describe the bug I am using opentelemetry input plugin along with cloudwatch_logs output. One of my applications is sending an OTLP formatted metric to fluent-bit. I see that fluent-bit is exporting this metric to cloudwatch in aws/emf format. However, the namespace in the payload seems to be missing. This even after I have specified metric_namespace in the output.
To Reproduce
[INPUT]
Name Opentelemetry
Listen 0.0.0.0
Port 4318
[OUTPUT]
Name cloudwatch_logs
Match v1_metrics
region eu-west-1
log_group_name /fluent-poc-cluster
log_stream_prefix fluent-poc-metrics
auto_create_group On
log_format json/emf
metric_namespace "fluent-bit-metric"
Cloudwatch log
{
"_aws": {
"Timestamp": 1754322754701,
"CloudWatchMetrics": [
{
"Namespace": "", <=== Missing!!!
"Dimensions": [
[]
],
"Metrics": [
{
"Name": "sdk_custom_metric",
"StorageResolution": 60
}
]
}
]
},
"prom_metric_type": "gauge",
"sdk_custom_metric": 42
}
- Steps to reproduce the problem:
- Install fluent-bit as deployment using helm chart with input and output as defined above
- Send OTLP metric
- Check logs in AWS console
Expected behavior Namespace should be present in aws/emf log. That will allow AWS to dynamically build the metric which is not happening at the moment.
Your Environment
- Version used: 4.0.4
- Configuration: OTLP input plugin and cloudwatch_logs output
- Environment name and version (e.g. Kubernetes? What version?): Kubernetes 1.32
- Server type and version: k8s
- Operating System and version: k8s
- Filters and plugins: NA
Additional context Unable to view metrics on AWS console using Fluent Bit
@mgshirali hi, in addition to fix the problem of the static set of the namespace, is there as well an expectation that the value must be set from a specific OTLP resource attribute ?
@mgshirali hi, in addition to fix the problem of the static set of the namespace, is there as well an expectation that the value must be set from a specific OTLP resource attribute ?
Hi @edsiper ,
The Namespace in the EMF formatted log could be static (No dynamism needed)
However, it would be nice to define the log_group_name and log_steam_name dynamically based on resource attributes. We were able to achieve this for the tag v1_logs using a lua script. However, for the tag v1_metrics - we have observed that the FILTER block is not invoked and as a result we are unable to build these up leveraging a lua script.
@edsiper , on second thoughts if the Namespace is dynamic too (derived from resource attributes), that would be even better. It will allow a lot of flexibility when configuring the output plugin.
+1 from my side,
-
Should allow dynamically selecting the Namespace based on the incoming OTLP metric record for example using the
service.namesapaceandservice.name -
Should allow execution of lua script via filter .
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.
This is still an issue