-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[exporter/Loki] Attributes and Resources has a attributes_ and resources_ prefix in Loki. #14190
Comments
Pinging code owners: @jpkrohling. |
Pinging code owners: @gramidt @gouthamve @jpkrohling @kovrus @mar4uk. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I'm very interested in this too. I'm looking into reducing the resource footprint on the clusters and replacing Promtail with OTL receiver @kago-dk Looks like from I'll be testing this within the next few weeks but I haven't tried yet |
(ignore my previous comment I was looking at the |
I believe this to be a characteristic of the filelog, not Loki, but I'll take a look at this in a couple of weeks. In the meantime, would you be able to use the |
I will retest using the latest OTEL Collector later this week. |
Just adding that I have put a docker-compose example that can be used to recreate the addition of the These issues may be semi-related if they both seem to be part of the logic that is used to convert OpenTelemetry attributes/resources into log entries. |
@kago-dk thank you! I see it now when I run query in json format: "{example_http_status_code="500"} | json" opentelemetry-collector-contrib/pkg/translator/loki/encode.go Lines 28 to 36 in cc0c784
When we run query with format |
True, it happens here: opentelemetry-collector-contrib/pkg/translator/loki/encode.go Lines 88 to 97 in cc0c784
This is on purpose, as we might have clashes between values under the same key at both the resources and record attributes. I'm not sure what would be the most appropriate for this situation. Perhaps use the key name, and the value for the most specific attribute (ie, record instead of resource)? In any case, this would be a breaking change that would need to be advertised well in advance. |
@kago-dk I have read through your description and comments once again.
For example, the json parsers will extract from the following document:
The following list of labels: Basically, the same thing is happening with log record attributes and resources:
"attributes_error_code" => "ABC" |
I think it's very important to be able to add, change even remove labels from a Loki entry and even when you're not splitting the screen... having consistent labels to search by is just peace of mind for the developer that needs to find a bug This would be a blocker for me to adopt OTEL as a log shipper instead of Promtail I could take a look and raise a PR but not sure when |
You can use the transform processor to change the attributes for a given record. I believe the Loki exporter should just export the data it received from the pipeline. About the specific problem of consistent labels among databases, I'm know that the other folks at Grafana are looking into ways to make this better. I believe there might even be a datasource mapping feature right now, which allows you to rename attributes on the fly. Ping me on the Grafana slack if you can't find a way to do it. |
Thanks for your response Juraci, regardless of the dynamic mapping I still think it's important to keep consistent labels across all the datasources so we a developer wants to filter by pod they don't have to know 3 different labels We are already using the mapping capacity to align Loki and Tempo (App -> OTEL -> Tempo) datasources but with the imminent addition of TraceQL on Grafana Tempo I'm looking at how to align these labels too |
Feedback noted, this is a pain we have right now and we want to solve this. |
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Currently, there is no work is happening toward removing prefixes.
It is possible to do this with attributes, resource, transform processors. You can set
There is flag |
I agree. I think there's a reasonable workaround in a place that is more appropriate than the Loki exporter. I'm closing, but I'm still happy to hear counterarguments. |
What happened?
Description
I am trying to take advantage of the “new” Loki Exporter in OTEL collector v0.60.0. Do I include all my resources and attributes from the filelog receiver as either loki.attribute.labels or loki.resource.labels? The answer is no based on this article https://grafana.com/blog/2020/08/27/the-concise-guide-to-labels-in-loki/.
If not, how do I avoid them showing up with the prefix of attributes (attributes_exception_stack_trace) or the prefix resources (resources_process_pid) in Loki.
Steps to Reproduce
Test using the testfile.log and otel-config.yaml
Expected Result
I am trying to avoid the attributes_ and resources_ shown in the (dark) screenshot. Even the hardcoded values with example_http_host_name and example_pod_name end up with the prefix in Loki (dark screenshot).
Collector version
v0.60.0
Environment information
## Environment OS: Windows Server 2019
OpenTelemetry Collector configuration
Log output
No response
Additional context
The text was updated successfully, but these errors were encountered: