grafana / cloudcost-exporter

Prometheus Exporter for Cloud Provider agnostic cost metrics
Apache License 2.0
30 stars 1 forks source link

AWS EKS: i4i.xlarge machine type reports CPU cost as 0 #179

Closed Pokom closed 4 months ago

Pokom commented 4 months ago

After deploying #169 I discovered that i4i.xlarge machine types cpu cost is being exported as 0 in us-east-2: image

The price should be closer to $0.17/hour: https://instances.vantage.sh/aws/ec2/i4i.large


The root cause is because the i4i is part of the storage optimized family and we don't handle that. image

The root cause is from the lookup here: https://github.com/grafana/cloudcost-exporter/blob/ffce31a953d77aba4fe1f5bc6dc642e310d12a18/pkg/aws/eks/pricing_map.go#L147

We do not have any catch all/defaults in the cpu to memory map: https://github.com/grafana/cloudcost-exporter/blob/ffce31a953d77aba4fe1f5bc6dc642e310d12a18/pkg/aws/eks/eks.go#L32-L36

Pokom commented 4 months ago

Probably the closest estimate we can get for figuring out the ratio of CPU/instance cost is via GCP's storage optimized instances. The math on it looks a bit like so:

  $.0496531/vCPU/hour * 88 vCPU = $4.369472/hour
+ $.0066553/GiB/hour * 704 GiB = $4.68531/hour
  ---------------------------------------
$4.369472/hour/vCPU / $9.054804000 / hour ~= 0.482558518

This aligns pretty well with our already existing Memory optimized figure. The question remains:

What do we default too if the instance family isn't found?