Additional prop support added for all metrics.
Description of the issue
Public docs state that the drop_original_metrics feature is supported, but, when we try to run it, the config translation states it isn't allowed: Under path : /metrics/metrics_collected/statsd | Error : Additional property drop_original_metrics is not allowed.
Description of changes
I allow drop_original_metrics for the statsd metric as well as other metrics that didn't have it (collectd and ethtool) and adjusted the CW exporter translator code to allow for this.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
I first replicated the issue and then tried running CWAgent with the following config:
{
"metrics": {
"aggregation_dimensions": [
["InstanceId"]
],
"metrics_collected": {
"statsd": {
"service_address": ":8125",
"metrics_collection_interval": 10,
"metrics_aggregation_interval": 50,
"drop_original_metrics": ["should_drop_24"]
}
}
}
}
The relevant errors are as follows (when we try using drop_original_metrics for all metrics collected):
Under path : /metrics/metrics_collected/ethtool | Error : Additional property drop_original_metrics is not allowed
Under path : /metrics/metrics_collected/collectd | Error : Additional property drop_original_metrics is not allowed
Under path : /metrics/metrics_collected/statsd | Error : Additional property drop_original_metrics is not allowed
After that, I re-ran the configuration and the error didn't persist.
Then, I ran echo "should_drop_24:123|c" | nc -u -w1 127.0.0.1 8125 and echo "should_not_drop_24:123|c" | nc -u -w1 127.0.0.1 8125.
As expected, the should_drop_24 didn't show up in the CW console, but should_not_drop_24 did.
We also see this in the yaml file:
exporters:
awscloudwatch:
drop_original_metrics:
should_drop_24: true
collectd
It didn't emit drop_cpu_value.
ethtool
It stopped emitting the metric when it was added to drop_original_metrics.
Additionally, I updated the unit tests to accommodate the changes made in this CR.
Requirements
Before commit the code, please do the following steps.
- Run
make fmtandmake fmt-sh - Run
make lint
This PR was marked stale due to lack of activity.
Mind adding a screenshot of what the metrics look like in CW console?
I would have expected an append_dimensions for the InstanceId so Im curious how it worked without that.
Will this parameter still drop metrics even if the aggregation_dimensions parameter is not being used ?
Will this parameter still drop metrics even if the
aggregation_dimensionsparameter is not being used ?
Yeah, it will still drop those metrics.