Skip to content

Commit 463d860

Browse files
Change type of metrics.MetricSample.connection field
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. Signed-off-by: Tiyash Basu <[email protected]>
1 parent dd26752 commit 463d860

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,49 @@ 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+
METRIC_CONNECTION_CATEGORY_UNSPECIFIED = 0;
180+
181+
// Represents a connection to a battery.
182+
METRIC_CONNECTION_CATEGORY_BATTERY = 1;
183+
184+
// Represents a connection to a PV array.
185+
METRIC_CONNECTION_CATEGORY_PV_ARRAY = 2;
186+
187+
// Represents a connection to a temperature sensor measuring the ambient
188+
// temperature.
189+
METRIC_CONNECTION_CATEGORY_AIR = 10;
190+
191+
// Represents a connection to a temperature sensor measuring the
192+
// temperature of a cabinet or enclosure.
193+
METRIC_CONNECTION_CATEGORY_CABINET = 11;
194+
195+
// Represents a connection to a temperature sensor measuring the
196+
// temperature of a heatsink or cooling element.
197+
// Represents a connection to a temperature sensor measuring the
198+
//
199+
// temperature of a transformer.
200+
METRIC_CONNECTION_CATEGORY_TRANSFORMER = 13;
201+
}
202+
203+
// Represents a connection from which a metric was obtained.
204+
message MetricConnection {
205+
// The category of the connection from which the metric was obtained.
206+
MetricConnectionCategory code = 1;
207+
208+
// A string that can be used to identify the specific connection from which
209+
// the metric was obtained.
210+
//
211+
// This is expected to be populated when the same `Metric` variant can be
212+
// obtained from multiple distinct inputs or connection points on the
213+
// component. Knowing the connection for the metric can help in certain
214+
// control and monitoring applications.
215+
string name = 2;
216+
}
217+
175218
// Representation of a sampled metric along with its value.
176219
//
177220
// !!! note
@@ -222,7 +265,7 @@ message MetricSample {
222265
// ==== values here are allowed and will be accepted
223266
repeated Bounds bounds = 4;
224267

225-
// An optional string that can be used to identify the specific connection
268+
// An optional field that can be used to identify the specific connection
226269
// from which the metric was obtained.
227270
//
228271
// This is expected to be populated when the same `Metric` variant can be
@@ -239,10 +282,21 @@ message MetricSample {
239282
// to determine the SoC of the battery using its voltage, identifying the
240283
// `dc_battery_0` connection is important.
241284
// - A sensor unit might report temperature from different connected probes
242-
// (e.g., `temp_sensor_outdoor`, `temp_sensor_indoor`).
285+
// (e.g., `temp_sensor_outdoor`, `temp_sensor_transformer`).
243286
//
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;
287+
// !!! note "Default Connection Behavior"
288+
// If this field is unset, it is implicitly assumed that the component
289+
// only has a single connection for this metric, and the connection is
290+
// uniquely identified by the component itself.
291+
//
292+
// !!! example
293+
// ```
294+
// // DC power from battery string 0 in a hybrid inverter
295+
// source {
296+
// category: BATTERY
297+
// name: "dc_battery_0"
298+
// }
299+
// ```
300+
301+
optional MetricConnection connection = 5;
248302
}

0 commit comments

Comments
 (0)