What's needed?
The live data streaming RPCs are using the frequenz.api.common.v1.microgrid.components.ComponentData message as the response, but this message is very flexible to allow streaming data efficiently in many different use cases (like streaming historical data).
Supporting all the provided flexibility is difficult for clients, so if there are some data restriction guarantees, these should be properly documented in the RPC response documentation so clients don't need to include unnecessary extra complexity.
Proposed solution
Document the ReceiveComponentDataStreamResponse.data field to mention that for a single response for a live data message:
- All the present
data.metric_samples and data.states will have the same sampled_at timestamp.
- Duplicate
metrics can only appear in the data.metric_samples if every metric have a different connection.name (so, connection should be present, and the name of the connection should not appear duplicated for a particular Metric).
- When a
metric appears only once, the connection information MAY be present. When a metric appears multiple times, all instances MUST have the connection information filled in.
- There will be at most one
data.states.1
The same restriction should documented for ReceiveSensorDataStreamResponse.data, adapting to the particular fields of that response.
Use cases
Live data streaming client implementation.
What's needed?
The live data streaming RPCs are using the
frequenz.api.common.v1.microgrid.components.ComponentDatamessage as the response, but this message is very flexible to allow streaming data efficiently in many different use cases (like streaming historical data).Supporting all the provided flexibility is difficult for clients, so if there are some data restriction guarantees, these should be properly documented in the RPC response documentation so clients don't need to include unnecessary extra complexity.
Proposed solution
Document the
ReceiveComponentDataStreamResponse.datafield to mention that for a single response for a live data message:data.metric_samplesanddata.stateswill have the samesampled_attimestamp.metrics can only appear in thedata.metric_samplesif every metric have a differentconnection.name(so,connectionshould be present, and the name of the connection should not appear duplicated for a particularMetric).metricappears only once, theconnectioninformation MAY be present. When ametricappears multiple times, all instances MUST have theconnectioninformation filled in.data.states.1The same restriction should documented for
ReceiveSensorDataStreamResponse.data, adapting to the particular fields of that response.Use cases
Live data streaming client implementation.
Footnotes
@tiyash-basu-frequenz could there be none? Or is it guaranteed to have at least one? In any case I don't think it makes a huge difference for the client implementation if it can be 0 or 1 or if is guaranteed to have 1, so we can leave it open. ↩