Skip to content

Commit 387cea9

Browse files
authored
Remove invalid HasField check on proto3 scalar metric value (#254)
Scalar fields do not have HasField check in proto3.
2 parents 4ff0b89 + b359e21 commit 387cea9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
## Bug Fixes
1616

17-
* Fix default value of formula-aggregated metrics when no data was sent.
17+
* Remove invalid HasField check on scalar which can cause failure retrieving formula-aggregated metrics.

src/frequenz/client/reporting/_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def sample(self) -> MetricSample:
190190
metric = Metric(config.metric).name
191191
# Ignoring this verification results in
192192
# values of zero if the field is not set.
193-
if sample.HasField("sample") and sample.sample.HasField("value"):
193+
if sample.HasField("sample"):
194194
value = sample.sample.value
195195
else:
196196
value = math.nan

0 commit comments

Comments
 (0)