Skip to content

Commit ccb76b6

Browse files
committed
Use a more descriptive channel name for the resampler
When trying to debug issues with the resampler not getting relevant data, the name of the channel is being used to identify the component and metric with issues, but the string contains other data, which makes it hard to identify the component and metric in the string. This commit uses a new, more descriptive channel name for for any component metric request, which is also used by the resampler. The previous string was: `component-stream::{component_id}::{metric_id.name}::{start_time}::{namespace}` The new string is: `component_metric_request<namespace={namespace},component_id={component_id},metric_id={metric_id.name},start={start_time}>` Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 5e3cfb8 commit ccb76b6

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525

2626
- Classes `Bounds` and `SystemBounds` now implement the `__contains__` method, allowing the use of the `in` operator to check whether a value falls within the bounds or not.
2727

28+
## Enhancements
29+
30+
- The resampler now shows an error message where it is easier to identify the component and metric when it can't find relevant data for the current resampling window.
31+
2832
## Bug Fixes
2933

3034
- Fixed a typing issue that occurs in some cases when composing formulas with constants.

src/frequenz/sdk/actor/_data_sourcing/_component_metric_request.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def get_channel_name(self) -> str:
4646
A string denoting a channel name.
4747
"""
4848
return (
49-
f"component-stream::{self.component_id}::{self.metric_id.name}::"
50-
f"{self.start_time}::{self.namespace}"
49+
f"component_metric_request<namespace={self.namespace},"
50+
f"component_id={self.component_id},"
51+
f"metric_id={self.metric_id.name},"
52+
f"start={self.start_time}>"
5153
)

src/frequenz/sdk/timeseries/_resampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ def resample(self, timestamp: datetime) -> Sample[Quantity]:
746746
# resort to some C (or similar) implementation.
747747
relevant_samples = list(itertools.islice(self._buffer, min_index, max_index))
748748
if not relevant_samples:
749-
_logger.warning("No relevant samples found for component: %s", self._name)
749+
_logger.warning("No relevant samples found for: %s", self._name)
750750
value = (
751751
conf.resampling_function(relevant_samples, conf, props)
752752
if relevant_samples

0 commit comments

Comments
 (0)