Cherry-pick #19345 to 7.x: Accept prefix as metric_types for stackdriver metricset in GCP #19606
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.
Cherry-pick of PR #19345 to 7.x branch. Original message:
What does this PR do?
This PR is to add accepting prefix using
metric_types
config parameter intostackdriver
metricset for user to specify a prefix of the metric types instead of listing out all metric types one by one in the config.Why is it important?
This will make stackdriver configuration a lot shorter/simpler. For example, if you want to collect all instance metric types for compute service, you can use:
Instead of listing all metric types like below:
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Note: I need to spend some time on figuring out how to mock GCP APIs or add integration tests for GCP overall in a separate PR.
How to test this PR locally
Enable
googlecloud
module and change googlecloud.yml to:Start Metricbeat and you should see these cpu metrics collected:
Note:
googlecloud.stackdriver.instance.cpu.scheduler_wait_time
might not exist because it is only available for VMs that belong to the e2 family and it's for measuring the wait time for vCPU is ready to run but unexpectedly not scheduled to run.