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

GCP Carbon footprint metricset #34820

Merged
merged 10 commits into from
Mar 28, 2023
Merged

GCP Carbon footprint metricset #34820

merged 10 commits into from
Mar 28, 2023

Conversation

dmathieu
Copy link
Member

@dmathieu dmathieu commented Mar 14, 2023

What does this PR do?

This PR sets up a new GCP metricbeat to retrieve the Google Carbon Footprint data, using the BigQuery export.

Why is it important?

This is required as part of setting up a GCP Cloud Carbon Footprint integration.
See elastic/integrations#2039

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.

Author's Checklist

  • [ ]

How to test this PR locally

Run the integration tests against the elastic-obs-integrations-dev GCP project.

cd x-pack/metricbeat/module/gcp/carbon
GCP_CREDENTIALS_FILE_PATH=<PATH TO CREDS FILE> GCP_PROJECT_ID=elastic-obs-integrations-dev go test -v ./... -tags integration,gcp,carbon

Related issues

Use cases

This PR introduces a new GCP metricbeat type, to retrieve Carbon Footprint data from BigQuery.

Logs

N/A

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 14, 2023
@dmathieu dmathieu added the Team:Cloud-Monitoring Label for the Cloud Monitoring team label Mar 14, 2023
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 14, 2023
@mergify
Copy link
Contributor

mergify bot commented Mar 14, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @dmathieu? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@dmathieu dmathieu changed the title Carbon footprint metricset GCP Carbon footprint metricset Mar 14, 2023
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 14, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-03-27T15:50:37.914+0000

  • Duration: 122 min 16 sec

Test stats 🧪

Test Results
Failed 0
Passed 25824
Skipped 1936
Total 27760

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@dmathieu dmathieu force-pushed the carbon-footprint branch 3 times, most recently from 353b244 to 6e6ef04 Compare March 14, 2023 11:19
@dmathieu dmathieu marked this pull request as ready for review March 14, 2023 13:48
@dmathieu dmathieu requested review from a team as code owners March 14, 2023 13:48
@dmathieu dmathieu requested review from ycombinator, fearful-symmetry and a team and removed request for a team March 14, 2023 13:48
Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments, but overall 👍 from me!

@@ -329,6 +329,13 @@ metricbeat.modules:
dataset_id: "dataset id"
table_pattern: "table pattern"
cost_type: "regular"
metricsets:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be under it's own - module: gcp section? As it stands, it looks like it's part of the previous - module: gcp section that has the billing metricset in it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's absolutely true. I guess the way it was overrides the billing metricset. I'm surprised no tests failed.

Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a nitpick but LGTM.

@dmathieu dmathieu merged commit 63865fd into main Mar 28, 2023
@dmathieu dmathieu deleted the carbon-footprint branch March 28, 2023 06:11
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
* set up carbon footprint metricset

* add changelog entry

* fix sample data

* add nolint:typecheck

* fix remaining lint errors

* fix data.json

* remove changelog-developer entry

* move carbon config into its own gcp module

* Update x-pack/metricbeat/module/gcp/_meta/config.yml

Co-authored-by: Shaunak Kashyap <[email protected]>

* run make update

---------

Co-authored-by: Shaunak Kashyap <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants