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

Cherry-pick #20812 to 7.x: [Metricbeat] Add billing metricset into googlecloud module #20923

Merged
merged 3 commits into from
Sep 4, 2020
Merged

Cherry-pick #20812 to 7.x: [Metricbeat] Add billing metricset into googlecloud module #20923

merged 3 commits into from
Sep 4, 2020

Conversation

kaiyan-sheng
Copy link
Contributor

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

Cherry-pick of PR #20812 to 7.x branch. Original message:

What does this PR do?

This PR is to add billing metricset into googlecloud module. For GCP, there is no direct billing API like AWS Cost Explorer to query for billing information. In order to get the billing date, users need to export billing reports into GCP BigQuery database and then this billing metricset can make some queries to get the actual billing data out.

Why is it important?

This will make GCP users' life a lot easier when tracking billing data 😄

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

It took me a while to get permissions for GCP billing account. Not sure how this will be tested in a short period of time. The config I used for billing metricset is:

- module: googlecloud
  metricsets:
    - billing
  project_id: "elastic-bi"
  credentials_file_path: "/Users/kaiyansheng/Desktop/elastic-bi-gcp.json"
  dataset_id: "master_gcp"
  table_pattern: "gcp_billing_export_v1"
  cost_type: "regular"
  period: 24h

Related issues

Screenshots

Screen Shot 2020-09-01 at 1 53 06 PM (2)

* Add billing metricset to googlecloud module

(cherry picked from commit ed6f101)
@kaiyan-sheng kaiyan-sheng added [zube]: In Review backport Team:Platforms Label for the Integrations - Platforms team labels Sep 2, 2020
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Sep 2, 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 Sep 2, 2020
@kaiyan-sheng kaiyan-sheng self-assigned this Sep 2, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Sep 2, 2020

💔 Tests Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20923 updated]

  • Start Time: 2020-09-03T20:30:47.784+0000

  • Duration: 100 min 49 sec

Test stats 🧪

Test Results
Failed 4
Passed 19398
Skipped 1841
Total 21243

Test errors

Expand to view the tests failures

  • Name: Build and Test / Elastic Agent Mac OS X / TestConfigurableService – operation

    • Age: 1
    • Duration: 0
    • Error Details: Failed
  • Name: Build and Test / Libbeat / Libbeat oss / TestOutputReload – pipeline

    • Age: 1
    • Duration: 60.07
    • Error Details: Failed
  • Name: Build and Test / Libbeat / Libbeat oss / TestOutputReload/client – pipeline

    • Age: 1
    • Duration: 34.47
    • Error Details: Failed
  • Name: Build and Test / Metricbeat OSS Python Integration tests / test_remote_write – metricbeat.module.prometheus.test_prometheus.TestRemoteWrite

    • Age: 1
    • Duration: 63.282
    • Error Details: beat.beat.TimeoutError: Timeout waiting for 'cond' to be true. Waited 60 seconds.

Steps errors

Expand to view the steps failures

  • Name: Mage build unitTest

    • Description: mage build unitTest

    • Duration: 72 min 23 sec

    • Start Time: 2020-09-03T20:56:53.098+0000

    • log

  • Name: Recursively delete the current directory from the workspace

    • Description: script returned exit code 1

    • Duration: 0 min 12 sec

    • Start Time: 2020-09-03T22:09:24.736+0000

    • log

  • Name: Mage build test

    • Description: mage build test

    • Duration: 21 min 23 sec

    • Start Time: 2020-09-03T20:58:57.386+0000

    • log

  • Name: Mage pythonIntegTest

    • Description: mage pythonIntegTest

    • Duration: 36 min 50 sec

    • Start Time: 2020-09-03T21:00:08.743+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-09-03T22:09:45.606Z] [INFO] unstashV2: JOB_GCS_BUCKET is set. bucket param got precedency instead.
[2020-09-03T22:09:45.629Z] [INFO] unstashV2: JOB_GCS_CREDENTIALS is set. credentialsId param got precedency instead.
[2020-09-03T22:09:45.748Z] [Google Cloud Storage Plugin] Found 1 files to download from pattern: gs://beats-ci-temp/Beats/beats/PR-20923-3/source/source.tgz
[2020-09-03T22:09:45.767Z] [Google Cloud Storage Plugin] Downloading: Beats/beats/PR-20923-3/source/source.tgz to local path: /var/lib/jenkins/workspace/Beats_beats_PR-20923/source.tgz
[2020-09-03T22:09:54.857Z] + tar --version
[2020-09-03T22:09:55.162Z] + tar -xpf source.tgz
[2020-09-03T22:10:07.727Z] + rm source.tgz
[2020-09-03T22:10:07.741Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats
[2020-09-03T22:10:07.764Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Lint
[2020-09-03T22:10:07.856Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-09-03T22:10:07.938Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-09-03T22:10:08.020Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Winlogbeat-oss
[2020-09-03T22:10:08.105Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Heartbeat-Mac-OS-X
[2020-09-03T22:10:08.185Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-09-03T22:10:08.266Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/dockerlogbeat
[2020-09-03T22:10:08.347Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-09-03T22:10:08.427Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-09-03T22:10:08.510Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Journalbeat
[2020-09-03T22:10:08.591Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-09-03T22:10:08.673Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-09-03T22:10:08.753Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-09-03T22:10:08.834Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Packetbeat-Linux
[2020-09-03T22:10:08.915Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-09-03T22:10:08.997Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-09-03T22:10:09.080Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Generators-Metricbeat-Mac-OS-X
[2020-09-03T22:10:09.160Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Functionbeat-Mac-OS-X-x-pack
[2020-09-03T22:10:09.242Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Heartbeat-Windows
[2020-09-03T22:10:09.322Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-09-03T22:10:09.401Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Heartbeat-oss
[2020-09-03T22:10:09.483Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Packetbeat-Mac-OS-X
[2020-09-03T22:10:09.563Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-09-03T22:10:09.645Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-09-03T22:10:09.726Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-09-03T22:10:09.810Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-09-03T22:10:09.890Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-09-03T22:10:09.975Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-09-03T22:10:10.056Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-09-03T22:10:10.137Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Filebeat-Windows
[2020-09-03T22:10:10.218Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Libbeat-x-pack
[2020-09-03T22:10:10.298Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-09-03T22:10:10.378Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Packetbeat-Windows
[2020-09-03T22:10:10.458Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Functionbeat-Windows
[2020-09-03T22:10:10.536Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Generators-Beat-Mac-OS-X
[2020-09-03T22:10:10.615Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-Windows
[2020-09-03T22:10:10.697Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-09-03T22:10:10.776Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Libbeat-oss
[2020-09-03T22:10:10.858Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-09-03T22:10:10.939Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-09-03T22:10:11.020Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Filebeat-x-pack
[2020-09-03T22:10:11.101Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-09-03T22:10:11.180Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Filebeat-oss
[2020-09-03T22:10:11.262Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests
[2020-09-03T22:10:11.345Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-OSS-Python-Integration-tests
[2020-09-03T22:10:11.426Z] Running in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-09-03T22:10:11.830Z] + cat
[2020-09-03T22:10:11.830Z] + /usr/local/bin/runbld ./runbld-script --job-name elastic+beats+pull-request
[2020-09-03T22:10:11.830Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-09-03T22:10:18.438Z] runbld>>> runbld started
[2020-09-03T22:10:18.439Z] runbld>>> 1.6.12/f45d832f2ba0aa2722ab4ec1fda8ad140f027f8b
[2020-09-03T22:10:20.358Z] runbld>>> The following profiles matched the job 'elastic+beats+pull-request' in order of occurrence in the config (last value wins).
[2020-09-03T22:10:20.358Z] runbld>>> Matches in the system config:
[2020-09-03T22:10:20.358Z] runbld>>> - Matched ^elastic\+beats
[2020-09-03T22:10:20.358Z] runbld>>> - Matched ^elastic\+beats\+pull-request
[2020-09-03T22:10:21.747Z] runbld>>> Debug logging enabled.
[2020-09-03T22:10:21.748Z] runbld>>> Storing result
[2020-09-03T22:10:22.009Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-09-03T22:10:22.009Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1597739501209/t/20200903221021-90BFC75C
[2020-09-03T22:10:22.009Z] runbld>>> Adding system facts.
[2020-09-03T22:10:23.402Z] runbld>>> Adding vcs info for the latest commit:  b4272883c16e1f94ede1f860eba391fefee7a6a5
[2020-09-03T22:10:23.402Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-09-03T22:10:23.402Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-09-03T22:10:23.402Z] Processing JUnit reports with runbld...
[2020-09-03T22:10:23.402Z] + echo 'Processing JUnit reports with runbld...'
[2020-09-03T22:10:23.663Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-09-03T22:10:23.664Z] runbld>>> DURATION: 34ms
[2020-09-03T22:10:23.664Z] runbld>>> STDOUT: 40 bytes
[2020-09-03T22:10:23.664Z] runbld>>> STDERR: 49 bytes
[2020-09-03T22:10:23.664Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-09-03T22:10:23.664Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats_PR-20923
[2020-09-03T22:10:24.608Z] runbld>>> Storing build metadata: 
[2020-09-03T22:10:24.608Z] runbld>>> Adding test report.
[2020-09-03T22:10:24.608Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats
[2020-09-03T22:10:25.182Z] runbld>>> Found 120 test output files
[2020-09-03T22:10:28.496Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-09-03T22:10:28.496Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats_PR-20923/src/github.com/elastic/beats/Metricbeat-OSS-Go-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-09-03T22:10:28.496Z] runbld>>> Test output logs contained: Errors: 0 Failures: 4 Tests: 21092 Skipped: 1573
[2020-09-03T22:10:28.757Z] runbld>>> Storing result
[2020-09-03T22:10:28.757Z] runbld>>> FAILURES: 4
[2020-09-03T22:10:29.703Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-09-03T22:10:29.703Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1597739501209/t/20200903221021-90BFC75C
[2020-09-03T22:10:29.964Z] runbld>>> Email notification disabled by environment variable.
[2020-09-03T22:10:29.964Z] runbld>>> Slack notification disabled by environment variable.
[2020-09-03T22:10:35.703Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats_PR-20923
[2020-09-03T22:10:35.943Z] [INFO] getVaultSecret: Getting secrets
[2020-09-03T22:10:36.041Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-09-03T22:10:37.149Z] + chmod 755 generate-build-data.sh
[2020-09-03T22:10:37.149Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20923/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20923/runs/3 FAILURE 5989103
[2020-09-03T22:10:37.149Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20923/runs/3/steps/?limit=10000 -o steps-info.json
[2020-09-03T22:10:40.378Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20923/runs/3/tests/?status=FAILED -o tests-errors.json
[2020-09-03T22:10:40.929Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats/PR-20923/runs/3/log/ -o pipeline-log.txt

@kaiyan-sheng kaiyan-sheng merged commit 1ca7bd4 into elastic:7.x Sep 4, 2020
@kaiyan-sheng kaiyan-sheng deleted the backport_20812_7.x branch September 4, 2020 02:41
@zube zube bot removed the [zube]: Done label Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Platforms Label for the Integrations - Platforms team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants