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

Accept prefix as metric_types for stackdriver metricset in GCP #19345

Merged
merged 7 commits into from
Jul 2, 2020
Merged

Accept prefix as metric_types for stackdriver metricset in GCP #19345

merged 7 commits into from
Jul 2, 2020

Conversation

kaiyan-sheng
Copy link
Contributor

@kaiyan-sheng kaiyan-sheng commented Jun 23, 2020

What does this PR do?

This PR is to add accepting prefix using metric_types config parameter into stackdriver 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:

- module: googlecloud
  metricsets:
    - stackdriver
  period: 1m
  metrics:
    - aligner: ALIGN_NONE
      service: compute
      metric_types: 
        - "instance"

Instead of listing all metric types like below:

- module: googlecloud
  metricsets:
    - stackdriver
  period: 1m
  metrics:
    - aligner: ALIGN_NONE
      service: compute
      metric_types:
        - "instance/cpu/reserved_cores"
        - "instance/cpu/scheduler_wait_time"
        - "instance/cpu/usage_time"
        - "instance/cpu/utilization"
        - "instance/disk/max_read_bytes_count"
        - "instance/disk/max_read_ops_count"
        - "instance/disk/max_write_bytes_count"
        - "instance/disk/max_write_ops_count"
        - "instance/disk/read_bytes_count"
        - "instance/disk/read_ops_count"
        ......

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.

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:

- module: googlecloud
  metricsets:
    - stackdriver
  zone: "europe-west1-c"
  project_id: elastic-observability
  credentials_file_path: "your JSON credentials file path"
  exclude_labels: false
  period: 1m
  metrics:
    - aligner: ALIGN_NONE
      service: compute
      metric_types: 
        - "instance/cpu"

Start Metricbeat and you should see these cpu metrics collected:

googlecloud.stackdriver.instance.cpu.reserved_cores.value
googlecloud.stackdriver.instance.cpu.usage_time.value
googlecloud.stackdriver.instance.cpu.utilization.value

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.

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 23, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 23, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19345 updated]

  • Start Time: 2020-07-01T21:24:21.123+0000

  • Duration: 36 min 58 sec

Test stats 🧪

Test Results
Failed 0
Passed 555
Skipped 128
Total 683

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

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

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 23, 2020
@kaiyan-sheng
Copy link
Contributor Author

@sorantis Does this metric_type_prefix align with your vision of configuring stackdriver metricset? TIA!

@sorantis
Copy link
Contributor

@kaiyan-sheng looks good! Is it possible to reuse the same parameter though?

- module: googlecloud
  metricsets:
    - stackdriver
  period: 1m
  metrics:
    - aligner: ALIGN_NONE
      service: compute
      metric_types:
        - "instance/cpu"
        - "guest/memory"
        ......

If not, then can the metric_type_prefix param be configured with multiple prefixes?

@kaiyan-sheng kaiyan-sheng changed the title Add metric_type_prefix for stackdriver metricset in GCP Accept prefix as metric_types for stackdriver metricset in GCP Jun 25, 2020
@kaiyan-sheng
Copy link
Contributor Author

@sorantis Yes, when we can use the same config, why add a new one 😄 I just changed the PR to accept prefix using metric_types config parameter. Thank you for the suggestion!!

@kaiyan-sheng kaiyan-sheng requested a review from sayden July 1, 2020 21:23
@kaiyan-sheng kaiyan-sheng merged commit 6bfe793 into elastic:master Jul 2, 2020
@kaiyan-sheng kaiyan-sheng deleted the metric_type_wildcard branch July 2, 2020 13:16
@zube zube bot removed the [zube]: In Review label Jul 2, 2020
@zube zube bot added the [zube]: Done label Jul 2, 2020
@kaiyan-sheng kaiyan-sheng added v7.9.0 and removed needs_backport PR is waiting to be backported to other branches. labels Jul 2, 2020
kaiyan-sheng added a commit that referenced this pull request Jul 2, 2020
…ver metricset in GCP (#19606)

* Accept prefix as metric_types for stackdriver metricset in GCP (#19345)

* Add metric_types for stackdriver metricset in GCP

(cherry picked from commit 6bfe793)
v1v added a commit to v1v/beats that referenced this pull request Jul 3, 2020
…ne-beats

* upstream/master: (35 commits)
  [ci] fix env variable name for xpack filebeats (elastic#19617)
  Cache error responses for cloudfoundry apps metadata (elastic#19181)
  ci: user fixed type of agent (elastic#19625)
  Input v2 cursor testing (elastic#19573)
  Update Jenkinsfile to not inspect removed vendor (elastic#19610)
  Fix ordering and duplicate configs on autodiscover (elastic#19317)
  Prepare input/file for changes in the registrar (elastic#19516)
  Cursor input and manager implementation (elastic#19571)
  [Filebeat] Fix tls mapping in suricata module (elastic#19494)
  [Ingest Manager] Make Agent beta and Constraints experimental (elastic#19586)
  Accept prefix as metric_types for stackdriver metricset in GCP (elastic#19345)
  Implement memlog store operations (elastic#19533)
  introduce journalbeat/pkg in order to provide reusable shared code (elastic#19581)
  Add descriptions to HAProxy fields in Metricbeat (elastic#19561)
  ci: apm-server-update trigered only on upstream, comments, and manual triggered (elastic#19590)
  ci: enable upstream triggering on the packaging job (elastic#19589)
  ci: some jjbb improvements (elastic#19588)
  [MetricBeat] set tags correctly if the dimension value is ARN (elastic#19433)
  [Filebeat] Add default_fields: false to fields.yml in aws module (elastic#19568)
  Add publisher implementation for stateful inputs (elastic#19530)
  ...
@andresrc andresrc added test-plan-added This PR has been added to the test plan and removed [zube]: Done labels Jul 14, 2020
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement review Team:Platforms Label for the Integrations - Platforms team test-plan Add this PR to be manual test plan test-plan-added This PR has been added to the test plan v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants