Skip to content

Commit 1ee12f7

Browse files
Add field source to MetricSample (#181)
This commit adds an optional string fieldthat can be used to identify the source of the metric. This is useful in cases where the same metric can be obtained from multiple sensors or sources in the same component. E.g., a hybrid inverter can have multiple DC strings, each with its own current and voltage sensors. In such cases, the source field can be used to differentiate between the different sources.
2 parents 5964b16 + 0e1de1a commit 1ee12f7

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
## New Features
1212

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
13+
- Added a field named `source` to `MetricSample` to allow the user to identify
14+
the source of the metric, in case different sensors in component report
15+
metrics with the same `Metric` variant.
1416

1517
## Bug Fixes
1618

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,20 @@ message MetricSample {
201201
// ---- values here are disallowed and will be rejected
202202
// ==== values here are allowed and will be accepted
203203
repeated Bounds bounds = 4;
204+
205+
// An optional string that can be used to identify the source of the metric.
206+
//
207+
// This is expected to be populated when the same `Metric` variant can be
208+
// obtained from multiple sensors in the component. Knowing the source of the
209+
// metric can help in certain control and monitoring applications.
210+
//
211+
// E.g., a hybrid inverter can have a DC string for a battery and another DC
212+
// string for a PV array. The source names could resemble, say,
213+
// `dc_battery_0` and ``dc_pv_0`. A metric like DC voltage can be obtained
214+
// from both sources. For an application to determine the SoC of the battery
215+
// using the battery voltage, the source of the voltage metric is important.
216+
//
217+
// In cases where the component has just one source for a metric, then this
218+
// field is not expected to be present, because the source is implicit.
219+
optional string source = 5;
204220
}

0 commit comments

Comments
 (0)