-
Notifications
You must be signed in to change notification settings - Fork 2.7k
delete_matching_keys(resource.attributes, ".*") causes state modification for subsequent entries in batch #37647
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
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I think this is because you are running the transform at the |
Thanks understood. |
/label processor/transformprocessor -processor/k8sattributes -processor/resourcedetection |
Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley @edmocosta. See Adding Labels via Comments if you do not have permissions to add labels yourself. For example, comment '/label priority:p2 -needs-triaged' to set the priority and remove the needs-triaged label. |
@DValentiev is the goal to get the resource attributes onto every log? If so, you can do this: transform:
error_mode: ignore
log_statements:
# For every log in a resource, add the resource attributes to the log attributes
- context: log
statements:
- merge_maps(attributes, resource.attributes, "upsert")
# Now that every log in the payload has their resource's attributes, delete the resource attributes.
- context: resource
statements:
- delete_matching_keys(attributes, ".*") |
Component(s)
processor/transformprocessor, exporter/googlecloud
What happened?
Description
googlecloud logs only supports a subset or resource labels produced by resourcedetection / k8sattributes processors.
Therefore when using googlecloud log exporter with resourcedetection / k8sattributes processors I have to move resource.attributes to attributes.
To avoid data duplication after merging resource.attributes I deleted them.
This caused resource.attributes to be empty for subsequent resources in processed batch.
Steps to Reproduce
Expected Result
resource.attributes is immutable between separate resource entries.
Actual Result
resource.attributes state carries over between separate log entries in a batch.
Collector version
otel/opentelemetry-collector-contrib:0.114.0
Environment information
EKS 1.31
OpenTelemetry Collector configuration
Log output
Additional context
Secondary bug / feature request:
Google cloud exporter should not pass all resource labels as GCP log
resource.labels
as the supported fields are restrictive:https://cloud.google.com/logging/docs/structured-logging
Instead most of the resource attributes should be passed as attributes which attaches them as log entry label.
The text was updated successfully, but these errors were encountered: