From e1fdbf900073d31af51add2a4136f084e8e7cdfc Mon Sep 17 00:00:00 2001 From: Daniel Zullo Date: Wed, 10 Apr 2024 16:00:11 +0200 Subject: [PATCH 1/2] Log when no relevant samples are found for resampling These additional logs will help in understanding why certain microgrid components, such as meters, fail to provide relevant samples for resampling. Signed-off-by: Daniel Zullo --- src/frequenz/sdk/timeseries/_resampling.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/frequenz/sdk/timeseries/_resampling.py b/src/frequenz/sdk/timeseries/_resampling.py index d4af6b9d9..316c7ab52 100644 --- a/src/frequenz/sdk/timeseries/_resampling.py +++ b/src/frequenz/sdk/timeseries/_resampling.py @@ -745,6 +745,8 @@ def resample(self, timestamp: datetime) -> Sample[Quantity]: # So if we need more performance beyond this point, we probably need to # resort to some C (or similar) implementation. relevant_samples = list(itertools.islice(self._buffer, min_index, max_index)) + if not relevant_samples: + _logger.warning("No relevant samples found for component: %s", self._name) value = ( conf.resampling_function(relevant_samples, conf, props) if relevant_samples From 922cb311063517b0136f03462f6e48d316b660cb Mon Sep 17 00:00:00 2001 From: Daniel Zullo Date: Thu, 11 Apr 2024 21:13:43 +0200 Subject: [PATCH 2/2] Update release notes To add an entry in the `Enhancements` session related to the new warning message that is logged when no relevant samples are found in a component for resampling. Signed-off-by: Daniel Zullo --- RELEASE_NOTES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 22f1d0695..3ccdef852 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -30,6 +30,8 @@ Another notable change is the microgrid API client being moved to its own [repos - Warning messages are logged when multiple instances of `*Pool`s are created for the same set of batteries, with the same priority values. +- A warning message will now be logged if no relevant samples are found in a component for resampling. + ## Bug Fixes - A bug was fixed where the grid fuse was not created properly and would end up with a `max_current` with type `float` instead of `Current`.