From 4947322abad3d22058bf3c65ce28d719be9f84c4 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 0f951a549..7b61dec6b 100644 --- a/src/frequenz/sdk/timeseries/_resampling.py +++ b/src/frequenz/sdk/timeseries/_resampling.py @@ -739,6 +739,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 f4cb37c224e50b5767bd6c830ff7271635d8458a 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 61ee6f2ad..19023042a 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -12,6 +12,10 @@ +## Enhancements + +- A warning message will now be logged if no relevant samples are found in a component for resampling. + ## Bug Fixes