Skip to content

Commit d5cb853

Browse files
Log when no relevant samples are found for resampling (#923)
These additional logs will help in understanding why certain microgrid components, such as meters, fail to provide relevant samples for resampling.
2 parents 8467009 + 922cb31 commit d5cb853

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Another notable change is the microgrid API client being moved to its own [repos
3030

3131
- Warning messages are logged when multiple instances of `*Pool`s are created for the same set of batteries, with the same priority values.
3232

33+
- A warning message will now be logged if no relevant samples are found in a component for resampling.
34+
3335
## Bug Fixes
3436

3537
- 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`.

src/frequenz/sdk/timeseries/_resampling.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ def resample(self, timestamp: datetime) -> Sample[Quantity]:
745745
# So if we need more performance beyond this point, we probably need to
746746
# resort to some C (or similar) implementation.
747747
relevant_samples = list(itertools.islice(self._buffer, min_index, max_index))
748+
if not relevant_samples:
749+
_logger.warning("No relevant samples found for component: %s", self._name)
748750
value = (
749751
conf.resampling_function(relevant_samples, conf, props)
750752
if relevant_samples

0 commit comments

Comments
 (0)