Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

## Bug Fixes

* Remove invalid HasField check on scalar which can cause failure retrieving formula-aggregated metrics.
* Fixes a bug where bounds of 0 were ignored and ensure the client always returns a pair of upper and lower bounds, were unset bounds are represented by +/- infinity.
16 changes: 8 additions & 8 deletions src/frequenz/client/reporting/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ def __iter__(self) -> Iterator[MetricSample]:

if self.has_bounds:
for i, bound in enumerate(sample.bounds):
if bound.lower:
yield MetricSample(
ts, mid, cid, f"{met}_bound_{i}_lower", bound.lower
)
if bound.upper:
yield MetricSample(
ts, mid, cid, f"{met}_bound_{i}_upper", bound.upper
)
lower = bound.lower if bound.HasField("lower") else -math.inf
yield MetricSample(
ts, mid, cid, f"{met}_bound_{i}_lower", lower
)
upper = bound.upper if bound.HasField("upper") else math.inf
yield MetricSample(
ts, mid, cid, f"{met}_bound_{i}_upper", upper
)
Comment on lines +122 to +129
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The bounds handling logic has been updated to fix the bug where zero values were ignored, but there are no tests covering this functionality. Consider adding tests that verify:

  1. Bounds with zero values are properly returned
  2. Missing bounds return infinity values as expected
  3. Both upper and lower bounds are always yielded as pairs

This is important to prevent regression of the bug that was just fixed.

Copilot uses AI. Check for mistakes.

for state in getattr(item, "state_snapshots", []):
ts = datetime_from_proto(state.origin_time)
Expand Down