Skip to content

Commit b408e0d

Browse files
Remove SensorMetricSample in favour of MetricSample
This commit removes the `SensorMetricSample` message in favour of using `MetricSample` for sensors. The `SensorMetricSample` message was a subset of the `MetricSample` message. From a design perspective focused on consistency, flexibility, and minimizing API surface area while handling variations via optional fields (which is idiomatic in Protobuf3), there's a strong argument that `SensorMetricSample` is redundant and potentially confusing, and that having only `MetricSample` is a cleaner design. Signed-off-by: Tiyash Basu <[email protected]>
1 parent 3840e36 commit b408e0d

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- Renamed `ComponentCatgoryMetadataVariant` to `ElectricalComponentCategorySpecificInfo`.
2626
- Renamed field `ElectricalComponent.category_type` to `ElectricalComponent.category_specific_info` to better reflect its purpose.
2727
- Renamed `metric_sample.proto` to `metrics.proto` to better reflect its content.
28+
- Remove `SensorMetricSample` in favour of using `MetricSample` for sensors.
2829

2930
## Bug Fixes
3031

proto/frequenz/api/common/v1/microgrid/sensors/sensors.proto

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ message SensorDiagnostic {
166166
// Optional human-readable message providing additional context.
167167
string message = 3;
168168
}
169-
169+
bopids
170170
// Representation of a sensor state and errors.
171171
message SensorState {
172172
// The time at which the state was sampled.
@@ -207,18 +207,6 @@ message SensorState {
207207
repeated SensorDiagnostic errors = 4;
208208
}
209209

210-
// Representation of a sampled sensor metric along with its value.
211-
message SensorMetricSample {
212-
// The UTC timestamp of when the metric was sampled.
213-
google.protobuf.Timestamp sampled_at = 1;
214-
215-
// The metric that was sampled.
216-
frequenz.api.common.v1.metrics.Metric metric = 2;
217-
218-
// The value of the sampled metric.
219-
frequenz.api.common.v1.metrics.MetricValueVariant value = 3;
220-
}
221-
222210
// SensorData message aggregates multiple metrics, operational states, and
223211
// errors, related to a specific microgrid sensor.
224212
//
@@ -233,11 +221,15 @@ message SensorMetricSample {
233221
// sampled_at: "2023-10-01T00:00:00Z",
234222
// metric: "METRIC_SENSOR_TEMPERATURE",
235223
// value: metric_value_variant: {simple_metric: {value: 23.5},
224+
// bounds: {}
225+
// source: {}
236226
// },
237227
// {
238228
// sampled_at: "2023-10-01T00:00:00Z",
239229
// metric: "METRIC_SENSOR_RELATIVE_HUMIDITY",
240230
// value: metric_value_variant: {simple_metric: {value: 23.5},
231+
// bounds: {}
232+
// source: "humidity_sensor_1"
241233
// }
242234
// ],
243235
// states: [
@@ -254,7 +246,7 @@ message SensorData {
254246
uint64 sensor_id = 1;
255247

256248
// List of measurements for a metric of the specific microgrid sensor.
257-
repeated SensorMetricSample metric_samples = 2;
249+
repeated frequenz.api.common.v1.metrics.MetricSample metric_samples = 2;
258250

259251
// List of states of a specific microgrid sensor.
260252
repeated SensorState states = 3;

0 commit comments

Comments
 (0)