Renewable Record Breakdown - rollthecloudinc/hedge GitHub Wiki

This document will discuss the purpose of each field inside the renewable record. The renewable record is generated added to Open Search every lambda execution. Additionally, a record for each region is created to provide comparison between regions on future charts. Given this data we can determine how much impact bouncing API requests between regions with lowest grid intensity actually has on reducing carbon emissions. We can compare the emissions of a service sitting in one region to that of a service/lambda that has been bounced between several regions. This will fill the existing measurement gap of hedge for internal services and octostore. Future additions will allow services to send back these metrics within response headers to integrate into the system using their own algorithms for calculations.

This strategy is inspired by Cloud Carbon Footprint. However, Cloud Carbon Footprint lacks real time calculations, actual memory part of energy calculation, near realtime grid intensity part of carbon calculation and open search integration + serverless solution. Therefore, the decision was made to integrate this directly into emissionless rather than using Cloud Carbon Footprint. Once integrated with Open search dashboards can be created that don't require any additional cloud servers / resources beyond Opensearch nodes and CDN to host web experience / dashboard.

Field Description Unit
Id Unique GUID
RequestId Unique request ID
Region HEDGE region
AwsRegion AWS Region
Duration How long the lambda ran ms
BilledDuration The amount of time billed for lambda execution ms
MemorySize Amount of memory allocated for function. mb
MaxMemoryUsed Maximum of memory the function execution actually used mb
InitDuration Amount of time lambda to initially start-up ms
Intensity Energy grid intensity inside executed region g/kWh
Electricity The amount of electricity used to execute lambda kWh
Carbon The amount of carbon emitted by function execution with respect to duration, intensity, memory @todo
Function The function name that was executed
Path When executed as part of api request the url path
Called Whether this is the called record or a placeholder for cross region carbon production comparing
Organization The organization that executed the function
Repository The repository that was used during function execution.
Service The HEDGE service name
Resource When executed through api gateway the resource path
type RenewableRecord struct {
	Id             string  `json:"id"`
	RequestId      string  `json:"request_id"`
	AwsRegion      string  `json:"aws_region"`
	Region         string  `json:"region"`
	Duration       uint16  `json:"duration"`
	BilledDuration uint16  `json:"billed_duration"`
	MemorySize     uint16  `json:"memory_size"`
	MaxMemoryUsed  uint16  `json:"max_memory_used"`
	InitDuration   uint16  `json:"init_duration"`
	Intensity      uint16  `json:"intensity"`
	Electricity    float64 `json:"electricity"`
	Carbon         float64 `json:"carbon"`
	Function       string  `json:"function"`
	Path           string  `json:"path"`
	Called         bool    `json:"called"`
	Organization   string  `json:"organization"`
	Repository     string  `json:"repository"`
	Service        string  `json:"service"`
	Resource       string  `json:"resource"`
}