[7.17](backport #40135) [aws] Fix missing metrics bug when include_linked_accounts set to false #40139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed commit message
This PR is to fix a bug in cloudwatch metricbeat module when include_linked_accounts is false. Because where the wrongly put return, we are missing metrics in pagination. I also added a test for the case when there is more than one page of results from ListMetrics API.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
No disruptive user impact.
How to test this PR locally
aws.yml
looks like this:You should see metrics only being collected from 2 RDS clusters. But if you change the
include_linked_accounts
totrue
, then you will get metrics from all clusters (5 in this case).3. Apply the changes from this PR and rebuild metricbeat locally. Run with the same
aws.yml
withinclude_linked_accounts
equals tofalse
and you should see metrics from all clusters now.Related issues
This is an automatic backport of pull request [aws] Fix missing metrics bug when include_linked_accounts set to false #40135 done by Mergify.