opencost / opencost-helm-chart

OpenCost Helm chart
Apache License 2.0
82 stars 87 forks source link

Add support for enabling the Carbon Cost API #211

Closed mattray closed 5 months ago

mattray commented 5 months ago

Enabled and test:

$ curl -G http://localhost:9003/assets/carbon -d window=7d | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1508  100  1508    0     0   3441      0 --:--:-- --:--:-- --:--:--  3435
{
  "code": 200,
  "status": "success",
  "data": {
    "GCP/__undefined__/mattray-opencost/Compute/gke-opencost/Node/Kubernetes/gke-opencost-1-default-pool-e40c4801-57g6/gke-opencost-1-default-pool-e40c4801-57g6": {
      "co2e": 0.006030856875453464
    },
    "GCP/__undefined__/mattray-opencost/Compute/gke-opencost/Node/Kubernetes/gke-opencost-1-default-pool-e40c4801-gtyn/gke-opencost-1-default-pool-e40c4801-gtyn": {
      "co2e": 0.006030856875453464
    },
    "GCP/__undefined__/mattray-opencost/Compute/gke-opencost/Node/Kubernetes/gke-opencost-1-default-pool-e40c4801-vnsv/gke-opencost-1-default-pool-e40c4801-vnsv": {
      "co2e": 0.006030856875453464
    },
    "GCP/__undefined__/mattray-opencost/Storage/gke-opencost/Disk/Kubernetes/gke-opencost-1-default-pool-e40c4801-57g6/gke-opencost-1-default-pool-e40c4801-57g6": {
      "co2e": 4.5047329090239456E-17
    },
    "GCP/__undefined__/mattray-opencost/Storage/gke-opencost/Disk/Kubernetes/gke-opencost-1-default-pool-e40c4801-gtyn/gke-opencost-1-default-pool-e40c4801-gtyn": {
      "co2e": 4.5047329090239456E-17
    },
    "GCP/__undefined__/mattray-opencost/Storage/gke-opencost/Disk/Kubernetes/gke-opencost-1-default-pool-e40c4801-vnsv/gke-opencost-1-default-pool-e40c4801-vnsv": {
      "co2e": 4.5047329090239456E-17
    },
    "GCP/__undefined__/mattray-opencost/Storage/gke-opencost/Disk/Kubernetes/pvc-4b32373c-0ffc-40c9-88b8-504854b32687/pvc-4b32373c-0ffc-40c9-88b8-504854b32687": {
      "co2e": 0
    },
    "GCP/__undefined__/mattray-opencost/Storage/gke-opencost/Disk/Kubernetes/pvc-95211d76-7842-4182-afa6-de4133f46b78/pvc-95211d76-7842-4182-afa6-de4133f46b78": {
      "co2e": 0
    }
  }
}
mattray commented 5 months ago

Fixes https://github.com/opencost/opencost-helm-chart/issues/210