diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 17f924e..0ef6e64 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -14,4 +14,4 @@ ## Bug Fixes -* Fix default value of formula-aggregated metrics when no data was sent. +* Remove invalid HasField check on scalar which can cause failure retrieving formula-aggregated metrics. diff --git a/src/frequenz/client/reporting/_types.py b/src/frequenz/client/reporting/_types.py index d8632ff..06db377 100644 --- a/src/frequenz/client/reporting/_types.py +++ b/src/frequenz/client/reporting/_types.py @@ -190,7 +190,7 @@ def sample(self) -> MetricSample: metric = Metric(config.metric).name # Ignoring this verification results in # values of zero if the field is not set. - if sample.HasField("sample") and sample.sample.HasField("value"): + if sample.HasField("sample"): value = sample.sample.value else: value = math.nan