rollthecloudinc / quell

Climate aware CMS breaking web apps free from carbon emissions.
https://demo.carbonfreed.app/pages/create-panel-page
GNU General Public License v3.0
14 stars 1 forks source link

Create reusable carbon reporting header #366

Open ng-druid opened 1 year ago

ng-druid commented 1 year ago

Create header for carbon reporting that can be used across entire enterprise. Configurable with branding options. This could be a plugin but think its best inside core as a library.

It would be ideal to have this ready for bloodhound and implemented.

We can pull hedge sci directly from opensearch but statsy will likely require a proxy. We also need to figure out how to pull offset from vendor api. That will likely need to be part of proxy as well.

It appears that when an order is placed using patch meta data can be associated. That meta data can be used to filter when fetching orders.

https://api.patch.io/api-docs/index.html

Need a proxy end-point. Different tokens would be required for other orgs using the platform.

Put the site ie. rollthecloudinc/carbonintense.world in metadata. That way the purchased offsets can be calculated easily.

Statsy api docs

https://statsy.com/rest-api#timeseries

Need a proxy end-point. Different tokens would be required for other orgs using the platform.

Fetch carbon footprint of a given site for an account. Example: rollthecloudinc:carbonintense.world

Screen Shot 2023-06-18 at 2 29 22 AM

Emissions

Emissions are calculated by combining statsy and hedge metrics.

Offset

Offset is calculated by aggregating all Patch order for a site. Although other vendors could also be supported, combined.

Remaining

Remaining emissions are calculated by subtracting offset from emissions.

Contribute

The contribute button opens the patch pop-up/modal.


We are going to do this by using periodical jobs to push data to our opensearch cluster. Once in opensearch we can easily query. Not to mention we can circumvent throttles, api outages on behalf of vendor.

We can use e-tags to make the fetch even more sustainable.

Concerns:

{
  "emissions": 12.000,
  "offset": 10.000
}

HEDGE:

GET /org/repo/metrics/header

separate service