-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[attributesprocessor] The resource
part of metrics include filtering config doesn't work
#30642
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
The readme doc says: "For metrics, one of metric_names or resources must be specified with a valid non-empty value for a valid configuration." So I think the |
And when I just specified the
It will update labels for all metrics ... |
To clarify your minimum reproducible config file, you're saying that with this config all metrics named If that's the case, could you post some example metrics from your logging output? |
hi, @crobert-1, please see the attached file for the full list of node exporter metrics. |
Okay, I'm seeing two main issues here.
There is another more supported way to do this though, using the transform processor. If you use the datapoint context you can use the |
Pinging code owners for processor/transform: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Hi @crobert-1 , thanks for your reply. |
And from the code here, the attributesprocessor processes the datapoint attribute, not resource attribute, too. I'll give a try to transform processor, thanks. |
That's correct, even if this bug is fixed the filter you've shared won't work with your data.
Yes, the attributes processor only supports operations on datapoint attributes for metrics, it does not support operations on resource attributes. |
Thanks for your confirmation :) |
In the transformprocessor it would look like transform:
error_mode: ignore
metric_statements:
- context: datapoint
statements:
- set(name, "zhangsan") where metric.name == "node_disk_write_time_seconds_total" and resource.attributes["device"] == "disk0" |
@chenlujjj I am going to close this issue for now since that transformprocessor config solves the use case you wanted. Please ping me if it doesnt work and I'll reopen. |
Thank you @TylerHelmuth
|
You're right, good correction! |
Component(s)
processor/attributes
What happened?
Description
As you can see in the attached collector config file, I tried to use the attributes processor to add labels for the metric
node_disk_write_time_seconds_total
only whendevice=disk0
NOTE: this is just a minimum example to reproduce the issue.
Steps to Reproduce
Expected Result
Actual Result
All the metrics
node_disk_write_time_seconds_total
even withdevice!=disk0
were updated as well.Collector version
0.79.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
Log output
No response
Additional context
In the source code:
The
ResourceAttributes
ofMatchProperties
doesn't take effect at all. Only the metric names are used to filter.The text was updated successfully, but these errors were encountered: