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

fix: Tag filters only allow single values per key #32775

Merged
merged 3 commits into from
Sep 7, 2022

Conversation

cjr125
Copy link
Contributor

@cjr125 cjr125 commented Aug 23, 2022

What does this PR do?

When filtering tags from the AWS Metricbeat module, it is not possible to specify more than one value associated to a particular key. This PR allows for that.

Why is it important?

A practical example of this would be filtering for more than one development environment (among others) on a single instance of Metricbeat.

Checklist

  • My code follows the style guidelines of this project
    - [ ] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Try loading the following AWS module config into Metricbeat:

aws.yml: |-
    - module: aws
      period: 1m
      regions: us-east-2
      metricsets:
        - cloudwatch
      metrics:
        - namespace: AWS/ApiGateway
          resource_type: apigateway
        - namespace: AWS/Lambda
          resource_type: lambda
      tags_filter:
        - key: "amwell:environment-name"
          value: "dev-next"
        - key: "amwell:environment-name"
          value: "stg01"

@cjr125 cjr125 requested a review from a team as a code owner August 23, 2022 12:33
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 23, 2022
@mergify
Copy link
Contributor

mergify bot commented Aug 23, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @cjr125? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@mergify mergify bot assigned cjr125 Aug 23, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 23, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-09-07T00:54:23.829+0000

  • Duration: 94 min 35 sec

Test stats 🧪

Test Results
Failed 0
Passed 4072
Skipped 1019
Total 5091

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@tommyers-elastic
Copy link
Contributor

thanks for your contribution! this seems like a reasonable enhancement to me. do you have thoughts @ravikesarwani ?

before we can merge we need a few things sorting:

  • please add appropriate unit tests
  • please update the documentation

thanks!

@cjr125 cjr125 force-pushed the review/multiValueTagFilter branch 4 times, most recently from 60e5ac2 to 290114b Compare August 23, 2022 18:49
@cjr125
Copy link
Contributor Author

cjr125 commented Aug 23, 2022

thanks for your contribution! this seems like a reasonable enhancement to me. do you have thoughts @ravikesarwani ?

before we can merge we need a few things sorting:

* please add appropriate unit tests

* please update the documentation

thanks!

The more I think about this, the more i realize that this might be a bigger problem. There is no way to distinguish between AND and OR logic with the filters I think is the real problem. Any advice?

@cjr125 cjr125 changed the title fix: Tag filters only allow single values per key draft: fix: Tag filters only allow single values per key Aug 24, 2022
@cjr125 cjr125 marked this pull request as draft August 24, 2022 05:09
@cjr125 cjr125 force-pushed the review/multiValueTagFilter branch 2 times, most recently from b26ff63 to e10634c Compare August 25, 2022 12:06
@mergify
Copy link
Contributor

mergify bot commented Aug 25, 2022

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b review/multiValueTagFilter upstream/review/multiValueTagFilter
git merge upstream/main
git push upstream review/multiValueTagFilter

@cjr125 cjr125 force-pushed the review/multiValueTagFilter branch 4 times, most recently from b65e355 to bb829af Compare August 28, 2022 22:32
@cjr125 cjr125 changed the title draft: fix: Tag filters only allow single values per key fix: Tag filters only allow single values per key Aug 28, 2022
@cjr125 cjr125 marked this pull request as ready for review August 28, 2022 22:48
@cjr125 cjr125 requested a review from a team as a code owner August 28, 2022 22:48
@cjr125 cjr125 requested review from fearful-symmetry and faec and removed request for a team August 28, 2022 22:48
@cjr125 cjr125 force-pushed the review/multiValueTagFilter branch 3 times, most recently from f6150c9 to a719f49 Compare August 31, 2022 18:25
@cmacknz cmacknz requested a review from a team August 31, 2022 23:49
@cjr125 cjr125 requested a review from a team as a code owner September 2, 2022 07:32
@cla-checker-service
Copy link

cla-checker-service bot commented Sep 2, 2022

💚 CLA has been signed

CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
@aspacca
Copy link
Contributor

aspacca commented Sep 6, 2022

@cjr125 it seems you force pushed a previous commit without the latest changes

Copy link
Contributor

@aspacca aspacca left a comment

Choose a reason for hiding this comment

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

force push without approved changes

@cjr125
Copy link
Contributor Author

cjr125 commented Sep 6, 2022

force push without approved changes

fixed

@cjr125 cjr125 closed this Sep 6, 2022
@cjr125 cjr125 reopened this Sep 6, 2022
@mergify
Copy link
Contributor

mergify bot commented Sep 6, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @cjr125? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

CHANGELOG.next.asciidoc Outdated Show resolved Hide resolved
When filtering tags from the AWS Metricbeat module, it is not possible to specify more than one value associated to a particular key. A practical example of this would be filtering for more than one development environment (among
others) on a single instance of Metricbeat.
@aspacca aspacca added the backport-v8.4.0 Automated backport with mergify label Sep 7, 2022
@aspacca
Copy link
Contributor

aspacca commented Sep 7, 2022

@cjr125 all good on my side

can you please sign the CLA?

@aspacca aspacca merged commit 3e07726 into elastic:main Sep 7, 2022
mergify bot pushed a commit that referenced this pull request Sep 7, 2022
* fix: Tag filters only allow single values per key

When filtering tags from the AWS Metricbeat module, it is not possible to specify more than one value associated to a particular key. A practical example of this would be filtering for more than one development environment (among
others) on a single instance of Metricbeat.

* Expand Unit Test Coverage

* Updated changelog

(cherry picked from commit 3e07726)
aspacca pushed a commit that referenced this pull request Sep 8, 2022
* fix: Tag filters only allow single values per key

When filtering tags from the AWS Metricbeat module, it is not possible to specify more than one value associated to a particular key. A practical example of this would be filtering for more than one development environment (among
others) on a single instance of Metricbeat.

* Expand Unit Test Coverage

* Updated changelog

(cherry picked from commit 3e07726)

Co-authored-by: cjr125 <croberts1@gmail.com>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* fix: Tag filters only allow single values per key

When filtering tags from the AWS Metricbeat module, it is not possible to specify more than one value associated to a particular key. A practical example of this would be filtering for more than one development environment (among
others) on a single instance of Metricbeat.

* Expand Unit Test Coverage

* Updated changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.4.0 Automated backport with mergify Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants