I’m trying to use the otel-lgtm docker image to locally test OpenTelemetry traces and logs correlation but I’ve been unable to correctly set the service_name label/resource attribute.
I have this compose.yml
Logs are ingested fine but I’m getting service_name=unknown_service and service_name_extracted=logger with every config option that allows me to set the service_name (or service.name)
Emable live debugging and check log structure om the otel exporter level. There must be resource attribute service.name with meaningful value. You can use some processor to configure it somehow.
The otelcol.exporter.otlp.default doesn’t seem to support live debugging but if I check the otelcol.processor.attributes.default component (which comes right before the exporter) I see these kind of objects
Hmm I see, that makes sense. I couldn’t find any reference to “transfer processor” on alloy docs though, do you mind giving me some more reference about it?
I did try at some point setting the attribute using a loki.process component but it did not work either
It seems all labels and static_labels are ignored in this case (or at least they don’t show up in this component debug view; the static label does show up in other component debug info)
Alloy is/was focused on Loki/Loki exporter and there is option to use log attributes to define Loki labels - you will need less configs for Loki.
But OTLP exporter needs transformations to achieve the same results.