grafana / alloy

OpenTelemetry Collector distribution with programmable pipelines
https://grafana.com/oss/alloy
Apache License 2.0
1.38k stars 201 forks source link

Docs feedback: loki.process labels values don't support empty strings #1695

Open jameshartig opened 1 month ago

jameshartig commented 1 month ago

URL

https://grafana.com/docs/alloy/latest/reference/components/loki/loki.process/

Feedback

The docs suggest you can set an empty value in the values key/value map but that's not actually supported by the code.

stage.labels {
    values = {
      env  = "",         // Sets up an 'env' label, based on the 'env' extracted value.
      user = "username", // Sets up a 'user' label, based on the 'username' extracted value.
    }
}

The above code snippet from the docs suggest that an empty value implies using the key but the code does not do that. See https://github.com/grafana/alloy/blob/1881ae4ee9b1d4fb3fa575902eb6287b53720c82/internal/component/loki/process/stages/labels.go#L71 and https://github.com/grafana/alloy/blob/1881ae4ee9b1d4fb3fa575902eb6287b53720c82/internal/component/loki/process/stages/structured_metadata.go#L50.

I would expect those to check for the value being empty but they're not.

github-actions[bot] commented 1 week ago

This issue has not had any activity in the past 30 days, so the needs-attention label has been added to it. If the opened issue is a bug, check to see if a newer release fixed your issue. If it is no longer relevant, please feel free to close this issue. The needs-attention label signals to maintainers that something has fallen through the cracks. No action is needed by you; your issue will be kept open and you do not have to respond to this comment. The label will be removed the next time this job runs if there is new activity. Thank you for your contributions!