If you are part of a Carbon/Green Ops team in charge with monitoring carbon emissions in GCP, this dashboard will empower you by allowing you to dive in your carbon data easily in Data Studio.
This dashboard assumes that the user has already configured exports to BigQuery for the billing data and carbon footprint data and has access to this table.
Note that this is required for the BigQuery datasets to be in the same GCP global region for this script to work.
Follow these links to configure the exports:
This will open an ephemeral Cloud Shell window with your credentials and this repository already cloned in the environment.
Make sure to trust the repository so that the code can execute properly.
pip3 install -r requirements.txt
There are two different options to create the BigQuery View and Data Studio URL.
Run the following command in the Cloud Shell environment
python3 main.py -f config.json
Configuration file structure:
config.json
{
"VIEW_PROJECT" : "",
"VIEW_DATASET" : "",
"VIEW_NAME" : "",
"BILLING_PROJECT" : "",
"BILLING_DATASET" : "",
"BILLING_TABLE" : "",
"CARBON_PROJECT" : "",
"CARBON_DATASET" : "",
"CARBON_TABLE" : "",
"CURRENCY": ""
}
Run the following command in the Cloud Shell environment :
python3 main.py -cp CARBON_PROJECT -cd CARBON_DATASET -ct CARBON_TABLE -bp BILLING_PROJECT -bd BILLING_DATASET -bt BILLING_TABLE -vp VIEW_PROJECT -vd VIEW_DATASET -vn VIEW_NAME -c CURRENCY
Explanation of each field:
Field | Description |
---|---|
CARBON_PROJECT | Project id of carbon export |
CARBON_DATASET | Dataset id of carbon export |
CARBON_TABLE | Table id of carbon export |
BILLING_PROJECT | Project id of billing export |
BILLING_DATASET | Dataset id of billing export |
BILLING_TABLE | Table id of billing export |
VIEW_PROJECT | Project id of final view |
VIEW_DATASET | Dataset id of final view |
VIEW_NAME | Name of final view |
CURRENCY | Currency in the billing data |
- May 2023: update dependencies, improve dashboard (add carbon footprint scope split)
- Dev 2022: Update view to new Carbon footprint data schema