-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7ba5ef9
set up carbon footprint metricset
dmathieu 527df69
add changelog entry
dmathieu 2b7865e
fix sample data
dmathieu 85de99c
add nolint:typecheck
dmathieu 7c0e5c1
fix remaining lint errors
dmathieu fc09070
fix data.json
dmathieu 0bbde46
remove changelog-developer entry
dmathieu ed9df0c
move carbon config into its own gcp module
dmathieu f93991f
Update x-pack/metricbeat/module/gcp/_meta/config.yml
dmathieu ed4cbcf
run make update
dmathieu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// | ||
This file is generated! See scripts/mage/docs_collector.go | ||
//// | ||
:edit_url: https://github.com/elastic/beats/edit/main/x-pack/metricbeat/module/gcp/carbon/_meta/docs.asciidoc | ||
|
||
|
||
[[metricbeat-metricset-gcp-carbon]] | ||
[role="xpack"] | ||
=== Google Cloud Platform carbon metricset | ||
|
||
beta[] | ||
|
||
include::../../../../x-pack/metricbeat/module/gcp/carbon/_meta/docs.asciidoc[] | ||
|
||
|
||
:edit_url: | ||
|
||
==== Fields | ||
|
||
For a description of each field in the metricset, see the | ||
<<exported-fields-gcp,exported fields>> section. | ||
|
||
Here is an example document generated by this metricset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../../x-pack/metricbeat/module/gcp/carbon/_meta/data.json[] | ||
---- | ||
:edit_url!: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"@timestamp": "2017-10-12T08:05:34.853Z", | ||
"cloud.account.id": "01475F-5B1080-1137E7", | ||
"cloud.project.id": "elastic-bi", | ||
"cloud.project.name": "elastic-containerlib-prod", | ||
"cloud.provider": "gcp", | ||
"event": { | ||
"dataset": "gcp.carbon", | ||
"duration": 115000, | ||
"module": "gcp" | ||
}, | ||
"gcp": { | ||
"carbon": { | ||
"project_id": "containerlib-prod-12763", | ||
"project_name": "elastic-containerlib-prod", | ||
"service_id": "24E6-581D-38E5", | ||
"service_description": "BigQuery", | ||
"footprint.scope1": 4.044, | ||
"footprint.scope2.location": 1.797, | ||
"footprint.scope2.market": null, | ||
"footprint.scope3": 2.337, | ||
"footprint.offsets": null | ||
} | ||
}, | ||
"metricset": { | ||
"name": "carbon", | ||
"period": 10000 | ||
}, | ||
"service": { | ||
"type": "gcp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
The `carbon` metricset is designed to collect Carbon Footprint data from GCP | ||
BigQuery monthly cost detail table. BigQuery is a fully-managed, serverless | ||
data warehouse. | ||
|
||
Cloud Carbon export to BigQuery enables you to export detailed Google Cloud | ||
carbon footprint data (such as carbon produced by tier and service) automatically | ||
throughout the month to a BigQuery dataset that you specify. Then you can access | ||
your Cloud Carbon data from BigQuery for detailed analysis using Metricbeat. | ||
Please see https://cloud.google.com/carbon-footprint/docs/export[export carbon | ||
footprint data to BigQuery] for more details on how to export carbon footprint data. | ||
|
||
[float] | ||
=== Metricset-specific configuration notes | ||
* *dataset_id*: (Required) Dataset ID that points to the top-level container which contains | ||
the actual carbon footprint tables. | ||
* *table_pattern*: (Optional) The name of the table where carbon footprint data | ||
is stored. Default to `carbon_footprint`. | ||
|
||
[float] | ||
=== Configuration example | ||
[source,yaml] | ||
---- | ||
- module: gcp | ||
metricsets: | ||
- carbon | ||
period: 24h | ||
project_id: "your project id" | ||
credentials_file_path: "your JSON credentials file path" | ||
dataset_id: "dataset id" | ||
table_name: "table name" | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
- name: carbon | ||
description: Google Cloud Carbon Footprint metrics | ||
release: beta | ||
type: group | ||
fields: | ||
- name: project_id | ||
type: keyword | ||
description: Project ID the carbon footprint report belongs to. | ||
- name: project_name | ||
type: keyword | ||
description: Project name the carbon footprint report belongs to. | ||
- name: service_id | ||
type: keyword | ||
description: Service ID for the carbon footprint usage. | ||
- name: service_description | ||
type: keyword | ||
description: Service description for the carbon footprint usage. | ||
- name: region | ||
type: keyword | ||
description: Region for the carbon fooprint usage. | ||
- name: footprint.scope1 | ||
type: float | ||
description: Scope 1 carbon footprint. | ||
- name: footprint.scope2.location | ||
type: float | ||
description: Scope 2 carbon footprint using location-based methodology. | ||
- name: footprint.scope2.market | ||
type: float | ||
description: Scope 2 carbon footprint using market-based methodology. | ||
- name: footprint.scope3 | ||
type: float | ||
description: Scope 3 carbon footprint. | ||
- name: footprint.offsets | ||
type: float | ||
description: Total carbon offsets. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
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 thebilling
metricset in it.There was a problem hiding this comment.
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.