@@ -17,6 +17,7 @@ import "google/protobuf/timestamp.proto";
1717import "frequenz/api/common/v1/metrics/metric_sample.proto" ;
1818import "frequenz/api/common/v1/microgrid/components/components.proto" ;
1919import "frequenz/api/common/v1/microgrid/microgrid.proto" ;
20+ import "frequenz/api/common/v1/microgrid/sensors/sensors.proto" ;
2021import "frequenz/api/common/v1/pagination/pagination_info.proto" ;
2122import "frequenz/api/common/v1/pagination/pagination_params.proto" ;
2223
@@ -47,6 +48,32 @@ service Reporting {
4748 // for a valid result.
4849 rpc ReceiveAggregatedMicrogridComponentsDataStream (ReceiveAggregatedMicrogridComponentsDataStreamRequest )
4950 returns (stream ReceiveAggregatedMicrogridComponentsDataStreamResponse ) {}
51+
52+ // Streams metrics for a list of microgrid sensors.
53+ //
54+ // !!! note
55+ // This RPC endpoint streams metrics data for sensors of one or more microgrids.
56+ // Clients need to provide at least one microgrid ID and one sensor ID
57+ // to get a result.
58+ rpc ReceiveMicrogridSensorsDataStream (ReceiveMicrogridSensorsDataStreamRequest )
59+ returns (stream ReceiveMicrogridSensorsDataStreamResponse ) {}
60+
61+ // Streams aggregated metrics based on user-defined formulas for a list of microgrid
62+ // sensors.
63+ //
64+ // !!! note
65+ // This RPC endpoint retrieves aggregated historical metrics data based on user-defined
66+ // formulas for microgrid sensors. At least one formula for one microgrid must be provided
67+ // for a valid result.
68+ rpc ReceiveAggregatedMicrogridSensorsDataStream (ReceiveAggregatedMicrogridSensorsDataStreamRequest )
69+ returns (stream ReceiveAggregatedMicrogridSensorsDataStreamResponse ) {}
70+ }
71+
72+ // Defines whether to include results in the response message.
73+ enum FilterOption {
74+ FILTER_OPTION_UNSPECIFIED = 0 ;
75+ FILTER_OPTION_EXCLUDE = 1 ;
76+ FILTER_OPTION_INCLUDE = 2 ;
5077}
5178
5279// Time-based filter for querying aggregated microgrid components data.
@@ -84,26 +111,6 @@ message ResamplingOptions {
84111 optional uint32 resolution = 1 ;
85112}
86113
87- // Include options for filtering microgrid components data.
88- //
89- // !!! note
90- // Specifies which additional fields should be included in the response.
91- //
92- message IncludeOptions {
93- // Defines whether to include results in the response message.
94- enum FilterOption {
95- FILTER_OPTION_UNSPECIFIED = 0 ;
96- FILTER_OPTION_EXCLUDE = 1 ;
97- FILTER_OPTION_INCLUDE = 2 ;
98- }
99-
100- // Optional bound inclusion. By default, bounds are not included in the response.
101- optional FilterOption bounds = 1 ;
102-
103- // Optional operational state inclusion. By default, states are not included in the response.
104- optional FilterOption states = 2 ;
105- }
106-
107114// Message defining the aggregation configuration for a custom formula within a specific microgrid.
108115//
109116// The AggregationConfig allows clients to specify how metrics should be aggregated across
@@ -237,6 +244,19 @@ message MetricConnections {
237244// like errors or operational states of the components during the specified time period.
238245//
239246message ReceiveMicrogridComponentsDataStreamRequest {
247+ // Include options for filtering microgrid components data.
248+ //
249+ // !!! note
250+ // Specifies which additional fields should be included in the response.
251+ //
252+ message IncludeOptions {
253+ // Optional bound inclusion. By default, bounds are not included in the response.
254+ optional FilterOption bounds = 1 ;
255+
256+ // Optional operational state inclusion. By default, states are not included in the response.
257+ optional FilterOption states = 2 ;
258+ }
259+
240260 // General filter criteria for querying microgrid components data.
241261 //
242262 // !!! note
@@ -412,3 +432,122 @@ message ReceiveAggregatedMicrogridComponentsDataStreamResponse {
412432 // Aggregated sample value and corresponding UTC timestamp when it was sampled.
413433 SimpleAggregatedMetricValue sample = 2 ;
414434}
435+
436+ // Request message for receiving a stream of metrics, such as electrical
437+ // measurements, and other information for individual microgrid sensors.
438+ //
439+ // !!! note
440+ // In addition to the raw metrics, the API can also return additional information
441+ // like errors or operational states of the sensors during the specified time period.
442+ //
443+ message ReceiveMicrogridSensorsDataStreamRequest {
444+ // Include options for filtering microgrid sensors data.
445+ //
446+ // !!! note
447+ // Specifies which additional fields should be included in the response.
448+ //
449+ message IncludeOptions {
450+ // Optional operational state inclusion. By default, states are not included in the response.
451+ optional FilterOption states = 1 ;
452+ }
453+
454+ // General filter criteria for querying microgrid sensors data.
455+ //
456+ // !!! note
457+ // The filter criteria defined here are applied universally across all
458+ // specified microgrids and their respective sensors.
459+ message StreamFilter {
460+ // Optional resampling options like resolution for the data, represented in seconds.
461+ // If omitted, data will be returned in its original representation.
462+ ResamplingOptions resampling_options = 1 ;
463+
464+ // Include options specifying additional fields to be included in the response.
465+ IncludeOptions include_options = 2 ;
466+
467+ // Optional time-based filter criteria.
468+ // If omitted, data will start streaming from the timestamp that the request was received.
469+ TimeFilter time_filter = 3 ;
470+ }
471+ // Encapsulates the microgrid ID and the sensor IDs within that microgrid for which
472+ // the historical data should be retrieved.
473+ //
474+ // !!! note
475+ // Each entry in this repeated field associates a microgrid ID with its respective
476+ // sensor IDs. At least one such association must be provided for a valid request.
477+ repeated frequenz.api.common.v1.microgrid.MicrogridSensorIDs microgrid_sensors = 1 ;
478+
479+ // List of metrics to receive data for, each possibly with connection filters.
480+ //
481+ // !!! note
482+ // At least one metric must be specified. Each metric can have an optional list of connections.
483+ // If connections are provided for a metric, only data from those connections will be returned.
484+ // If no connections are provided for a metric, data from all connections will be returned for that metric.
485+ repeated MetricConnections metrics = 2 ;
486+
487+ // General filter that applies to the data retrieval for all specified microgrids and sensors.
488+ //
489+ // !!! note
490+ // The filter can specify a list of metrics to be return but also specify bounds, operational
491+ // state, or errors to be returned.
492+ StreamFilter filter = 3 ;
493+ }
494+
495+ // Response containing a single data sample for one microgrid's sensors.
496+ //
497+ // !!! note
498+ // The microgrid's sensors are provided as single data samples that
499+ // encapsulate metrics, bounds, errors, and operational states along with their
500+ // associated timestamps. Each response message covers a single microgrid.
501+ // If multiple microgrids are provided in the request, expect sequential messages
502+ // in the stream.
503+ //
504+ message ReceiveMicrogridSensorsDataStreamResponse {
505+ // Microgrid ID for which the sensors and samples are reported.
506+ uint64 microgrid_id = 1 ;
507+
508+ // List of sensors within this microgrid, each with its associated data samples.
509+ repeated frequenz.api.common.v1.microgrid.sensors.SensorData sensors = 2 ;
510+ }
511+
512+ // Message defining the request format for streaming aggregated historical metrics.
513+ // This request allows to specify custom aggregation formulas, along with general
514+ // filtering.
515+ //
516+ // At least one aggregation formula config must be provided. The aggregation
517+ // follows the passive sign convention.
518+ //
519+ message ReceiveAggregatedMicrogridSensorsDataStreamRequest {
520+ // General filter criteria for querying microgrid sensors data.
521+ message AggregationStreamFilter {
522+ // Optional resampling options like resolution for the data, represented in seconds.
523+ // If omitted, data will be returned in its original representation.
524+ ResamplingOptions resampling_options = 1 ;
525+
526+ // Optional time-based filter criteria.
527+ // If omitted, data will start streaming from the timestamp that the request was received.
528+ TimeFilter time_filter = 2 ;
529+ }
530+
531+ // List of pairs of metric and corresponding aggregation formula.
532+ repeated AggregationConfig aggregation_configs = 1 ;
533+
534+ // General streaming filter that applies to all formula aggregations.
535+ AggregationStreamFilter filter = 2 ;
536+ }
537+
538+ // Message defining the response format for a stream that fetches aggregated real-time metrics
539+ // for the provided custom aggregation formulas.
540+ //
541+ // !!! note
542+ // The formula and metric must have been specified in the corresponding request.
543+ // A single aggregated sample for the metric is returned in the sample field. Each message
544+ // covers a single formula. For multiple formulars provided in the request, expect sequential
545+ // messages in the stream.
546+ //
547+ message ReceiveAggregatedMicrogridSensorsDataStreamResponse {
548+ // The metric and formula that has been used to aggregate the sample.
549+ AggregationConfig aggregation_config = 1 ;
550+
551+ // Aggregated sample value and corresponding UTC timestamp when it was sampled.
552+ SimpleAggregatedMetricValue sample = 2 ;
553+ }
0 commit comments