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

cloudwatchlogs_log_group_metric_filter: add support for unit and dimensions #2286

Conversation

jmisset-cb
Copy link
Contributor

SUMMARY

This PR adds support for the options unit and dimensions in the cloudwatchlogs_log_group_metric_filter module.
This enables configuring unit and dimensions in Cloudwatch Logs Metricfilters using ansible, which was previously not possible.

The addition is pretty straigthforward since both unit and dimensions are part of the metric_transformation parameter.

dimensions and default_value are mutually exclusive, however:

  1. The AWS API does not fail when both are present, instead the dimensions are simply ignored.
  2. Since they are not top-level parameters, the ansible module option mutually_exclusive was not possible. Instead a custom check was added to the module that throws an error when both parameters are present.

An integration test has been added for this case, as well as for configuring metric_filters with units and/or dimensions.

The function metricTransformationHandler has been rewritten slightly due to the addition of the two extra optional parameters, to make it a bit more readable.

Happy to get your feedback!

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

cloudwatchlogs_log_group_metric_filter

ADDITIONAL INFORMATION

Copy link

github-actions bot commented Sep 6, 2024

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/cb34eda3496e441daefda3a79324a6e1

✔️ ansible-galaxy-importer SUCCESS in 3m 49s
✔️ build-ansible-collection SUCCESS in 10m 31s
✔️ ansible-test-splitter SUCCESS in 4m 20s
✔️ integration-amazon.aws-1 SUCCESS in 6m 38s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/d11025a52359410b8471894bf4fc6a03

✔️ ansible-galaxy-importer SUCCESS in 3m 29s
✔️ build-ansible-collection SUCCESS in 10m 51s
✔️ ansible-test-splitter SUCCESS in 4m 25s
✔️ integration-amazon.aws-1 SUCCESS in 7m 52s
Skipped 43 jobs

Copy link
Collaborator

@GomathiselviS GomathiselviS left a comment

Choose a reason for hiding this comment

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

Thank you for working on this PR. Please update the Return block of the module documentation with the new parameters.

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/93a01376ee924b60bfee2b2f40a68765

✔️ ansible-galaxy-importer SUCCESS in 4m 26s
✔️ build-ansible-collection SUCCESS in 10m 40s
✔️ ansible-test-splitter SUCCESS in 4m 22s
✔️ integration-amazon.aws-1 SUCCESS in 8m 47s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/0da9c9d56da44db2b0f3e8bfe19969a7

✔️ ansible-galaxy-importer SUCCESS in 4m 41s
✔️ build-ansible-collection SUCCESS in 10m 42s
✔️ ansible-test-splitter SUCCESS in 4m 23s
✔️ integration-amazon.aws-1 SUCCESS in 9m 42s
Skipped 43 jobs

@alinabuzachis alinabuzachis added the backport-8 PR should be backported to the stable-8 branch label Sep 12, 2024
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/d9f5b6cdc81943da93128ba4674874bb

✔️ ansible-galaxy-importer SUCCESS in 5m 24s
✔️ build-ansible-collection SUCCESS in 10m 35s
✔️ ansible-test-splitter SUCCESS in 4m 51s
✔️ integration-amazon.aws-1 SUCCESS in 6m 50s
Skipped 43 jobs

@alinabuzachis
Copy link
Collaborator

@jmisset-cb Can you please rebase this branch?

@jmisset-cb jmisset-cb force-pushed the log_group_metric_filter_add_unit_and_dimensions branch from abc75bc to 8f52905 Compare October 7, 2024 07:01
@jmisset-cb
Copy link
Contributor Author

@jmisset-cb Can you please rebase this branch?

@alinabuzachis Done!

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/37d270a5f01440cf85cebc7ed7f4e244

✔️ ansible-galaxy-importer SUCCESS in 4m 11s
✔️ build-ansible-collection SUCCESS in 10m 31s
✔️ ansible-test-splitter SUCCESS in 4m 15s
✔️ integration-amazon.aws-1 SUCCESS in 7m 05s
Skipped 43 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/2a08ee0ebeb841e8b480d1e53ef530f7

✔️ ansible-galaxy-importer SUCCESS in 5m 10s
✔️ build-ansible-collection SUCCESS in 10m 23s
✔️ ansible-test-splitter SUCCESS in 4m 14s
✔️ integration-amazon.aws-1 SUCCESS in 7m 35s
Skipped 43 jobs

@GomathiselviS GomathiselviS added the mergeit Merge the PR (SoftwareFactory) label Oct 24, 2024
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/8eee29ea5d09479189d8d310ac4ed51f

✔️ ansible-galaxy-importer SUCCESS in 5m 21s
✔️ build-ansible-collection SUCCESS in 10m 44s
✔️ ansible-test-splitter SUCCESS in 3m 58s
✔️ integration-amazon.aws-1 SUCCESS in 7m 21s
Skipped 43 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 118905b into ansible-collections:main Oct 24, 2024
36 of 37 checks passed
Copy link

patchback bot commented Oct 24, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/118905b8004526bfc8289ba41e0ac3d053d347c6/pr-2286

Backported as #2361

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Oct 24, 2024
…nsions (#2286)

SUMMARY

This PR adds support for the options unit and dimensions in the cloudwatchlogs_log_group_metric_filter module.
This enables configuring unit and dimensions in Cloudwatch Logs Metricfilters using ansible, which was previously not possible.
The addition is pretty straigthforward since both unit and dimensions are part of the metric_transformation parameter.
dimensions and default_value are mutually exclusive, however:

The AWS API does not fail when both are present, instead the dimensions are simply ignored.
Since they are not top-level parameters, the ansible module option mutually_exclusive was not possible. Instead a custom check was added to the module that throws an error when both parameters are present.

An integration test has been added for this case, as well as for configuring metric_filters with units and/or dimensions.
The function metricTransformationHandler has been rewritten slightly due to the addition of the two extra optional parameters, to make it a bit more readable.
Happy to get your feedback!

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

cloudwatchlogs_log_group_metric_filter
ADDITIONAL INFORMATION

Reviewed-by: GomathiselviS <[email protected]>
Reviewed-by: Jasper Misset
Reviewed-by: Alina Buzachis
(cherry picked from commit 118905b)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Oct 25, 2024
…nsions (#2286) (#2361)

This is a backport of PR #2286 as merged into main (118905b).
SUMMARY

This PR adds support for the options unit and dimensions in the cloudwatchlogs_log_group_metric_filter module.
This enables configuring unit and dimensions in Cloudwatch Logs Metricfilters using ansible, which was previously not possible.
The addition is pretty straigthforward since both unit and dimensions are part of the metric_transformation parameter.
dimensions and default_value are mutually exclusive, however:

The AWS API does not fail when both are present, instead the dimensions are simply ignored.
Since they are not top-level parameters, the ansible module option mutually_exclusive was not possible. Instead a custom check was added to the module that throws an error when both parameters are present.

An integration test has been added for this case, as well as for configuring metric_filters with units and/or dimensions.
The function metricTransformationHandler has been rewritten slightly due to the addition of the two extra optional parameters, to make it a bit more readable.
Happy to get your feedback!

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

cloudwatchlogs_log_group_metric_filter
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 PR should be backported to the stable-8 branch mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants