Skip to content

Specify data guarantees for live data streaming #282

@llucax

Description

@llucax

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.

Footnotes

  1. @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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    part:docsAffects the documentationpart:protobufAffects the protocol buffer definition filestype:enhancementNew feature or enhancement visitble to users

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions