Skip to content

Commit f3a3e2f

Browse files
committed
Improve documentation of ComponentMetricRequest
In particular clarify the use of the `namespace` attribute and its relationship with the channel name. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent ff786cd commit f3a3e2f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@
1313

1414
@dataclass
1515
class ComponentMetricRequest:
16-
"""A request object to start streaming a metric for a component."""
16+
"""A request to start streaming a metric for a component.
1717
18-
namespace: str
19-
"""The namespace that this request belongs to.
18+
This request is used by the resampling and data sourcing actors to allow other
19+
actors to subscribe to the data stream of a component's metric.
2020
21-
Metric requests with a shared namespace enable the reuse of channels within
22-
that namespace.
21+
The channel to use to receive the data stream is determined by the by the client
22+
creating the request, but need to be unique in the channel's registry. For this
23+
a `namespace` is used to make the channel name unique.
2324
24-
If for example, an actor making a multiple requests, uses the name of the
25-
actor as the namespace, then requests from the actor will get reused when
26-
possible.
25+
The actor processing the request then will start streaming the data to the channel
26+
with the name constructed from the request, as requested by the client. One could
27+
also see the `namespace` as a *client ID*.
2728
"""
2829

30+
namespace: str
31+
"""The namespace that this request belongs to. See the class docs for more info."""
32+
2933
component_id: int
3034
"""The ID of the requested component."""
3135

0 commit comments

Comments
 (0)