Skip to content

Commit 4bbcdc8

Browse files
Change type of metrics.MetricSample.connection field (#372)
This commit changes the type of the `metrics.MetricSample.connection` field from `string` to a new message type `metrics.MetricConnection`. This change allows for better categorization of the connection type, which can be useful in control and monitoring applications. The new `MetricConnection` message includes a `MetricConnectionCategory` enum that categorizes the connection type (e.g., battery, PV array, temperature`s), and a `name` field that can be used to identify the specific connection point from which the metric was obtained. closes #258
2 parents dd26752 + 930bbcf commit 4bbcdc8

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373

7474
- The file `location.proto` has been moved to the `types` package, moving the message `Location` to `types.Location`.
7575

76+
- The type of the field `metrics.MetricSample.connection` has been changed from `string` to `metrics.MetricConnection`. The latter is a newly added message that provides a better categorization of the connection type.
77+
7678
## New Features
7779

7880
Added many new messages and enum values:

proto/frequenz/api/common/v1/metrics/metrics.proto

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,50 @@ enum Metric {
172172
METRIC_SENSOR_IRRADIANCE = 166;
173173
}
174174

175+
// Enumerated categories of connections from which metrics can be obtained for a
176+
// given electrical component or sensor.
177+
enum MetricConnectionCategory {
178+
// Default value.
179+
// Do not use this value.
180+
METRIC_CONNECTION_CATEGORY_UNSPECIFIED = 0;
181+
182+
// A generic connection for metrics that do not fit into any other category.
183+
METRIC_CONNECTION_CATEGORY_OTHER = 1;
184+
185+
// A connection to a metric representing a battery.
186+
METRIC_CONNECTION_CATEGORY_BATTERY = 2;
187+
188+
// A connection to a metric representing a photovoltaic (PV) array or string.
189+
METRIC_CONNECTION_CATEGORY_PHOTOVOLTAIC = 3;
190+
191+
// A connection to a metric representing ambient conditions.
192+
METRIC_CONNECTION_CATEGORY_AMBIENT = 10;
193+
194+
// A connection to a metric representing a cabinet or an enclosure.
195+
METRIC_CONNECTION_CATEGORY_CABINET = 11;
196+
197+
// A connection to a metric representing a heatsink.
198+
METRIC_CONNECTION_CATEGORY_HEATSINK = 12;
199+
200+
// A connection to a metric representing a transformer.
201+
METRIC_CONNECTION_CATEGORY_TRANSFORMER = 13;
202+
}
203+
204+
// A connection to a metric representing from which a metric was obtained.
205+
message MetricConnection {
206+
// The category of the connection from which the metric was obtained.
207+
MetricConnectionCategory category = 1;
208+
209+
// A string that can be used to identify the specific connection from which
210+
// the metric was obtained.
211+
//
212+
// This is expected to be populated when the same `Metric` variant can be
213+
// obtained from multiple distinct inputs or connection points on the
214+
// component. Knowing the connection for the metric can help in certain
215+
// control and monitoring applications.
216+
string name = 2;
217+
}
218+
175219
// Representation of a sampled metric along with its value.
176220
//
177221
// !!! note
@@ -222,7 +266,7 @@ message MetricSample {
222266
// ==== values here are allowed and will be accepted
223267
repeated Bounds bounds = 4;
224268

225-
// An optional string that can be used to identify the specific connection
269+
// An optional field that can be used to identify the specific connection
226270
// from which the metric was obtained.
227271
//
228272
// This is expected to be populated when the same `Metric` variant can be
@@ -239,10 +283,20 @@ message MetricSample {
239283
// to determine the SoC of the battery using its voltage, identifying the
240284
// `dc_battery_0` connection is important.
241285
// - A sensor unit might report temperature from different connected probes
242-
// (e.g., `temp_sensor_outdoor`, `temp_sensor_indoor`).
286+
// (e.g., `temp_sensor_outdoor`, `temp_sensor_transformer`).
287+
//
288+
// !!! note "Default Connection Behavior"
289+
// If this field is unset, it is implicitly assumed that the component
290+
// only has a single connection for this metric, and the connection is
291+
// uniquely identified by the component itself.
243292
//
244-
// In cases where the component has just one such connection for a metric,
245-
// or the context is otherwise unambiguous, this field is not expected to
246-
// be present, because the connection is implicit.
247-
optional string connection = 5;
293+
// !!! example
294+
// ```
295+
// // DC power from battery string 0 in a hybrid inverter
296+
// source {
297+
// category: METRIC_CONNECTION_CATEGORY_BATTERY
298+
// name: "dc_battery_0"
299+
// }
300+
// ```
301+
optional MetricConnection connection = 5;
248302
}

0 commit comments

Comments
 (0)