thegreenwebfoundation / grid-intensity-go

A tool written in go to help you factor carbon intensity into decisions about where and when to run computing jobs.
Apache License 2.0
65 stars 7 forks source link

Add CO2 Signal as provider #65

Closed fershad closed 1 year ago

fershad commented 1 year ago

ElectricityMaps offers a free API call CO2signal. The API provides access to the latest carbon intensity data (at a country level). Since it is free, having this integration would make Grid Intensity Go a viable option for developers to use in hackathons, demo projects, prototypes and the like.

The API requires an API key for access, and is rate limited to 30 requests per hour/1 per second.

API docs can be found at: https://docs.co2signal.com/

rossf7 commented 1 year ago

Hey @fershad @mrchrisadams 👋 I took a look at adding CO2 Signal as a provider but you probably saw that ElectricityMaps announced a free tier last week?

https://www.electricitymaps.com/news/our-free-api-is-now-available-among-our-other-products

We can support this by making the Electricity Map API URL configurable via an env var.

Changes are here https://github.com/thegreenwebfoundation/grid-intensity-go/pull/71 and I also fixed a :bug: with setting the valid_from and valid_to dates.

I've been integrating with their API for another project so as AIUI there are 3 types of base URLs we need to support.

Maybe we should also change the default URL to the free tier?

mrchrisadams commented 1 year ago

hi @rossf7 ! That makes a lot of sense - I think this is a good idea. I'll respond in #71 with any comments there.

mrchrisadams commented 1 year ago

We should also probably close this, or make a new issue for supporting the endpoints.

rossf7 commented 1 year ago

Thanks Chris <3 closing in favour of #72