Skip to content

Commit ebf585f

Browse files
Remove SensorMetricSample in favour of MetricSample (#346)
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. closes #339
2 parents d863621 + 3567a48 commit ebf585f

File tree

2 files changed

+7
-53
lines changed

2 files changed

+7
-53
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
- Renamed `SensorState` to `SensorStateSnapshot` to better reflect its purpose.
3636
- Renamed `sampled_at` timestamps for state snapshots to `origin_time`.
3737
- Renamed `sampled_at` timestamps for metric samples to `sample_time`.
38+
- Remove `SensorMetricSample` in favour of using `MetricSample` for sensors.
39+
- Remove `SensorMetric` enum, since it was unused and redundant.
3840

3941
## Bug Fixes
4042

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

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,46 +42,6 @@ enum SensorCategory {
4242
SENSOR_CATEGORY_GENERAL = 7;
4343
}
4444

45-
// Enumrated sensor metrics.
46-
enum SensorMetric {
47-
// Unspecified.
48-
SENSOR_METRIC_UNSPECIFIED = 0;
49-
50-
// Temperature.
51-
// In Celsius (°C).
52-
SENSOR_METRIC_TEMPERATURE = 1;
53-
54-
// Humidity
55-
// In percentage (%).
56-
SENSOR_METRIC_HUMIDITY = 2;
57-
58-
// Pressure
59-
// In Pascal (Pa).
60-
SENSOR_METRIC_PRESSURE = 3;
61-
62-
// Irradiance / Radiation flux
63-
// In watts per square meter (W / m^2).
64-
SENSOR_METRIC_IRRADIANCE = 4;
65-
66-
// Velocity
67-
// In meters per second (m / s).
68-
SENSOR_METRIC_VELOCITY = 5;
69-
70-
// Acceleration.
71-
// In meters per second per second (m / s^2)
72-
SENSOR_METRIC_ACCELERATION = 6;
73-
74-
// Metric to represent angles, for metrics like direction.
75-
// In angles with respect to the (magnetic) North (°).
76-
SENSOR_METRIC_ANGLE = 7;
77-
78-
// Dew point.
79-
// The temperature at which the air becomes saturated with water vapor.
80-
//
81-
// In Celsius (°C).
82-
SENSOR_METRIC_DEW_POINT = 8;
83-
}
84-
8545
// Enum to represent the various states that a sensor can be in.
8646
// This enum is unified across all sensor categories for consistency.
8747
enum SensorStateCode {
@@ -207,18 +167,6 @@ message SensorStateSnapshot {
207167
repeated SensorDiagnostic errors = 4;
208168
}
209169

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 sample_time = 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-
222170
// SensorData message aggregates multiple metrics, operational states, and
223171
// errors, related to a specific microgrid sensor.
224172
//
@@ -233,11 +181,15 @@ message SensorMetricSample {
233181
// sample_time: "2023-10-01T00:00:00Z",
234182
// metric: "METRIC_SENSOR_TEMPERATURE",
235183
// value: metric_value_variant: {simple_metric: {value: 23.5},
184+
// bounds: {}
185+
// source: {}
236186
// },
237187
// {
238188
// sample_time: "2023-10-01T00:00:00Z",
239189
// metric: "METRIC_SENSOR_RELATIVE_HUMIDITY",
240190
// value: metric_value_variant: {simple_metric: {value: 23.5},
191+
// bounds: {}
192+
// source: "humidity_sensor_1"
241193
// }
242194
// ],
243195
// states: [
@@ -254,7 +206,7 @@ message SensorData {
254206
uint64 sensor_id = 1;
255207

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

259211
// List of states of a specific microgrid sensor.
260212
repeated SensorStateSnapshot states = 3;

0 commit comments

Comments
 (0)