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

[Metricbeat] Fix cloudwatch metricset missing tags collection #17424

Merged
merged 8 commits into from
Apr 3, 2020
Merged

[Metricbeat] Fix cloudwatch metricset missing tags collection #17424

merged 8 commits into from
Apr 3, 2020

Conversation

kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Apr 2, 2020

What does this PR do?

This PR is to fix cloudwatch metricset from missing tags when tags.resource_type_filter is given. When user tries to collect daily storage metrics and s3 bucket tags with the cloudwatch metricset, it will fail to collect tags. This is because for CloudWatch metrics from S3 buckets, they always have StorageType as dimension. Dimension and S3 bucket name are combined to be the identifierValue in cloudwatch metricset code. But when collecting tags, dimension StorageType is not collected. That's why there is a mismatch between identifierValue and resourceTagMap.

Why is it important?

This PR will fix tags collection for all namespaces that always have a dimension reported in CloudWatch metrics.

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

  1. Make sure the AWS account you use for testing has S3 buckets with tags.
  2. Use config below for aws.yml:
- module: aws
  period: 86400s
  metricsets:
    - cloudwatch
  metrics:
    - namespace: AWS/S3
      tags.resource_type_filter: s3
  1. After starting Metricbeat, you should see tags collected from S3 buckets.

Related issues

@kaiyan-sheng kaiyan-sheng self-assigned this Apr 2, 2020
@kaiyan-sheng kaiyan-sheng added bug Metricbeat Metricbeat needs_backport PR is waiting to be backported to other branches. Team:Platforms Label for the Integrations - Platforms team labels Apr 2, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

Copy link
Member

@ChrsMark ChrsMark 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 fixing this!

Overall looks good, left some minors.

x-pack/metricbeat/module/aws/cloudwatch/cloudwatch_test.go Outdated Show resolved Hide resolved
x-pack/metricbeat/module/aws/cloudwatch/cloudwatch.go Outdated Show resolved Hide resolved
@kaiyan-sheng kaiyan-sheng merged commit 68cdcf9 into elastic:master Apr 3, 2020
@kaiyan-sheng kaiyan-sheng deleted the fix_s3_tags branch April 3, 2020 16:43
@kaiyan-sheng kaiyan-sheng added v7.8.0 and removed needs_backport PR is waiting to be backported to other branches. labels Apr 3, 2020
kaiyan-sheng added a commit that referenced this pull request Apr 3, 2020
#17477)

* Fix cloudwatch metricset missing tags

(cherry picked from commit 68cdcf9)
kaiyan-sheng added a commit that referenced this pull request Apr 3, 2020
#17478)

* Fix cloudwatch metricset missing tags

(cherry picked from commit 68cdcf9)
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…c#17424) (elastic#17478)

* Fix cloudwatch metricset missing tags

(cherry picked from commit db335be)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Metricbeat Metricbeat Team:Platforms Label for the Integrations - Platforms team v7.7.0 v7.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Metricbeat] Cloudwatch metricset does not collect S3 tags correctly
3 participants