Skip to content

Commit 014c1a2

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 1396317 commit 014c1a2

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
@@ -54,9 +54,12 @@ def get_channel_name(self) -> str:
5454
Returns:
5555
A string representing the channel name.
5656
"""
57+
start = f",start={self.start_time}" if self.start_time else ""
5758
return (
58-
f"component_metric_request<namespace={self.namespace},"
59+
"component_metric_request<"
60+
f"namespace={self.namespace},"
5961
f"component_id={self.component_id},"
60-
f"metric_id={self.metric_id.name},"
61-
f"start={self.start_time}>"
62+
f"metric_id={self.metric_id.name}"
63+
f"{start}"
64+
">"
6265
)

0 commit comments

Comments
 (0)