Skip to content
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

Drop original metrics support added for all metrics. #1206

Merged
merged 17 commits into from
Jul 23, 2024

Conversation

musa-asad
Copy link
Contributor

@musa-asad musa-asad commented Jun 7, 2024

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": {
        "namespace": "DropTest-1",
        "aggregation_dimensions": [
            ["Group"]
        ],
        "metrics_collected": {
            "statsd": {
                "service_address": ":8125",
                "metrics_collection_interval": 1,
                "metrics_aggregation_interval": 5,
                "drop_original_metrics": ["should_drop"]
            }
        }
    }
}

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:123|c|#Group:Dropped" | nc -u -w1 127.0.0.1 8125 and echo "should_not_drop:123|c|#Group:Not_Dropped" | nc -u -w1 127.0.0.1 8125.

As expected, the should_drop didn't show up in the CW console in its original form, but should_not_drop did. However, they both showed up in their aggregated forms.
image
image
Image (1)

We also see this in the yaml file:

exporters:
    awscloudwatch:
        drop_original_metrics:
            should_drop: true

collectd
The drop_cpu_value didn't show up in the CW console in its original form, but show_cpu_value did. However, they both showed up in their aggregated forms.
Image (2)
Image (3)
Image (4)

ethtool
The ethtool_queue_0_rx_bytes didn't show up in the CW console in its original form, but ethtool_queue_0_tx_bytes did. However, they both showed up in their aggregated forms.
Image (5)
image
image

Additionally, I updated the unit tests to accommodate the changes made in this PR.

Requirements

Before commit the code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

@musa-asad musa-asad requested review from jefchien and sky333999 June 7, 2024 21:42
@musa-asad musa-asad self-assigned this Jun 7, 2024
@musa-asad musa-asad requested a review from a team as a code owner June 7, 2024 21:42
Copy link
Contributor

This PR was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label Jun 18, 2024
@github-actions github-actions bot removed the Stale label Jun 21, 2024
@sky333999
Copy link
Contributor

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.

@musa-asad musa-asad requested review from mitali-salvi and jefchien and removed request for sky333999 July 3, 2024 19:30
Copy link
Contributor

@mitali-salvi mitali-salvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you verify that that even though the original metric is being dropped, its still captured as part of the aggregation metric ?

@mitali-salvi
Copy link
Contributor

Will this parameter still drop metrics even if the aggregation_dimensions parameter is not being used ?

@musa-asad
Copy link
Contributor Author

Will this parameter still drop metrics even if the aggregation_dimensions parameter is not being used ?

Yeah, it will still drop those metrics.

@musa-asad musa-asad changed the title Additional prop support added for all metrics. Drop original metrics support added for all metrics. Jul 8, 2024
@musa-asad musa-asad requested a review from Paramadon July 9, 2024 16:12
@musa-asad musa-asad requested a review from mitali-salvi July 16, 2024 13:43
@musa-asad musa-asad merged commit b63ec24 into aws:main Jul 23, 2024
6 checks passed
@musa-asad musa-asad deleted the statsd-add-props branch August 16, 2024 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants