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

Moving GMT to microjoules #932

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Moving GMT to microjoules #932

wants to merge 24 commits into from

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Oct 3, 2024

@greptileai

Greptile Summary

This PR implements a significant database schema change and standardization of energy measurements to use microjoules (uJ) instead of millijoules (mJ) across the Green Metrics Tool.

  • Splits measurements table into measurement_metrics and measurement_values with new indexes in structure.sql and migration script
  • Converts all energy values from mJ to uJ (x1000) in migration script and updates metric providers accordingly
  • Adds integer sampling rate columns (avg, max, 95p) to phase_stats table for improved precision tracking
  • Updates frontend converters.js to handle microjoule units while maintaining watthour display option
  • Migration lacks transaction block and proper handling of non-mJ energy units, risking data inconsistency

The changes look technically sound but require careful validation of unit conversions and data migration. The PR improves precision through standardized microjoule measurements while maintaining backward compatibility.

Copy link

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 26.6011 1954.89 4.02 486
Measurement #1 26.5669 1954.89 4.03 485

❌ CO2 Data:
Error in retrieving values. Please see the detailed logs for the exact error messages!

@ArneTR ArneTR marked this pull request as ready for review January 3, 2025 18:42
ArneTR added 2 commits January 4, 2025 02:43
* main:
  Measurement table split (#1039)
  (fix): end measurement can appear twice in notes, which is superflous
  No need for strict null check
  Bump orjson from 3.10.12 to 3.10.13 (#1037)
  Bump anybadge from 1.14.0 to 1.15.6 (#1038)
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

47 file(s) reviewed, 39 comment(s)
Edit PR Review Bot Settings | Greptile

api/main.py Outdated Show resolved Hide resolved
api/api_helpers.py Show resolved Hide resolved
api/api_helpers.py Outdated Show resolved Hide resolved
docker/structure.sql Outdated Show resolved Hide resolved
docker/structure.sql Outdated Show resolved Hide resolved
tests/lib/test_phase_stats.py Outdated Show resolved Hide resolved
tests/lib/test_phase_stats.py Show resolved Hide resolved
tests/smoke_test.py Show resolved Hide resolved
tests/smoke_test.py Show resolved Hide resolved
tools/calibrate.py Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

45 file(s) reviewed, 15 comment(s)
Edit PR Review Bot Settings | Greptile

docker/structure.sql Outdated Show resolved Hide resolved
ee Show resolved Hide resolved
ee Show resolved Hide resolved
frontend/js/helpers/config.js.example Show resolved Hide resolved
frontend/js/helpers/converters.js Show resolved Hide resolved
tests/lib/test_phase_stats.py Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

11 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

case 'centi°C':
return [transformIfNotNull(value, 100), unit.substr(5)];
case 'Hz':
return [transformIfNotNull(value, 1_000_000_000), `G${unit}`];
Copy link

Choose a reason for hiding this comment

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

logic: Hz conversion adds unit without stripping old unit first - will result in 'GHz' instead of just 'GHz'

Comment on lines 236 to 238
markline = {
precision: 4, // generally annoying that precision is by default 2. Wrong AVG if values are smaller than 0.001 and no autoscaling!
data: [ {type: "average",label: {formatter: "AVG\n(selection):\n{c}"}}]
Copy link

Choose a reason for hiding this comment

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

style: Consider using a constant for the precision value of 4 to make it more maintainable

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.

1 participant