Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add carbon estimation functionality to assets #2653

Merged
merged 5 commits into from Mar 19, 2024

Conversation

kaelanspatel
Copy link
Contributor

What does this PR change?

Adds carbon estimation functionality to Opencost /assets, assigning a carbon cost in CO2e to each node/disk based off a lookup table.

Enabled by setting the CARBON_ESTIMATES_ENABLED env var.

Does this PR relate to any other PRs?

No.

How will this PR impact users?

  • Adds the /assets/carbon endpoint to Opencost, allowing users to see carbon costs for node and disk assets.

Does this PR address any GitHub or Zendesk issues?

  • Closes ...

How was this PR tested?

  • Locally against Prom by querying endpoint.
  • On an existing install of Opencost by querying endpoint.

Does this PR require changes to documentation?

  • Yes.

Have you labeled this PR and its corresponding Issue as "next release" if it should be part of the next OpenCost release? If not, why not?

Copy link

vercel bot commented Mar 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
opencost ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 19, 2024 6:32pm

kaelanspatel and others added 2 commits March 18, 2024 14:55
Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>
Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>
w.Write(WrapData(carbonEstimates, nil))
}

func (a *Accesses) computeAssetsFromCostmodel(window opencost.Window, filterString string) (*opencost.AssetSet, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an excellent change regardless

pkg/carbon/carbonassets.go Outdated Show resolved Hide resolved
pkg/carbon/carbonassets.go Outdated Show resolved Hide resolved
Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>
@kaelanspatel kaelanspatel marked this pull request as ready for review March 19, 2024 18:09
@michaelmdresser michaelmdresser merged commit b4643da into opencost:develop Mar 19, 2024
5 of 6 checks passed
Copy link

sonarcloud bot commented Mar 19, 2024

nik-kc pushed a commit to nik-kc/opencost that referenced this pull request Apr 4, 2024
* Simple preliminary framework for carbon assets

Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>

* Fix cost using whole window instead of active mins

Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>

* change carbon lookup struct + cleanup

Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>

---------

Signed-off-by: Kaelan Patel <32113845+kaelanspatel@users.noreply.github.com>
Signed-off-by: Nik Willwerth <nwillwerth@kubecost.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants