Skip to content

Conversation

@Matyro
Copy link

@Matyro Matyro commented Dec 15, 2025

Description

Added auto cleanup after shutdown from push gateway
Renamed several attributes and fixed kw to kwh
Added total power to avoid race conditions with push gateway and prometheus crawler

Related Issue

Implemented #975

Motivation and Context

Race conditions between push gateway updates and crawling via promethus accumulate over time and skew the total over time

Push gateway does not automatically remove entries after termination of the program, therefore the last value is kept until manually removed. For cluster environments this is not feasible

How Has This Been Tested?

The changes are extracted from the fork currently running in our cluster environment and we monitor the jobs with grafana
I am currently investigating methods to improve the autoclean

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Added auto cleanup after shutdown from push gateway
Renamed attributes
@Matyro Matyro requested a review from a team as a code owner December 15, 2025 09:11
@Matyro Matyro mentioned this pull request Dec 15, 2025
9 tasks
@Matyro
Copy link
Author

Matyro commented Dec 16, 2025

@cianc
Could you review the changes? This should be nearly identical to the changes in the PID Branch


energy_consumed_total_doc = MetricDocumentation(
"codecarbon_energy_total",
description="Accumulated cpu_energy, gpu_energy and ram_energy (kWh)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description="Accumulated cpu_energy, gpu_energy and ram_energy (kWh)",
description="Accumulated cpu_energy, gpu_energy and ram_energy (kWh) since the start of the run",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants