Skip to content

Commit 1875bed

Browse files
committed
Make the channel name shorter for ComponentMetricRequest
The `start_time` is optional, and rarely used (for the time being not even supported), so there is no need to include it in the channel name when it is not present at all. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent f3a3e2f commit 1875bed

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ def get_channel_name(self) -> str:
5151
Returns:
5252
A string denoting a channel name.
5353
"""
54+
start = f",start={self.start_time}" if self.start_time else ""
5455
return (
55-
f"component_metric_request<namespace={self.namespace},"
56+
"component_metric_request<"
57+
f"namespace={self.namespace},"
5658
f"component_id={self.component_id},"
57-
f"metric_id={self.metric_id.name},"
58-
f"start={self.start_time}>"
59+
f"metric_id={self.metric_id.name}"
60+
f"{start}"
61+
">"
5962
)

0 commit comments

Comments
 (0)