Skip to content

Commit 2eac4a3

Browse files
Add communication component state codes and snapshot message
This commit adds a new enum `CommunicationComponentStateCode` to represent the high-level operational state of a communication component. It also introduces a new message `CommunicationComponentStateSnapshot` that captures a snapshot of the component's state, diagnostics, and timing. This is useful for monitoring and diagnosing the status of communication components in a microgrid system. Signed-off-by: Tiyash Basu <[email protected]>
1 parent d0833cb commit 2eac4a3

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- Added warnings to sensor `SensorState`.
2121
- Added a common `TimeIntervalFilter` message in `frequenz.api.common.v1.types` to standardize time interval filtering across APIs. This uses `start_time` (inclusive) and `end_time` (exclusive) fields, aligning with ISO 8601 and common programming conventions.
2222
- Added new message `CommunicationComponentDiagnostic` to represent warnings and errors in microgrid communication components.
23+
- Added new message `CommunicationComponentStateSnapshot` to represent the state of communication components.
2324
- Added new message definitions for streaming events (Deleted, Created, Updated)
2425

2526
## Bug Fixes

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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,34 @@ syntax = "proto3";
1212

1313
package frequenz.api.common.v1.microgrid.communication_components;
1414

15+
// Defines the high-level operational state of a communication component.
16+
// These codes can be used in a one-shot snapshot to show its current condition.
17+
enum CommunicationComponentStateCode {
18+
// Default unset value.
19+
COMMUNICATION_COMPONENT_STATE_CODE_UNSPECIFIED = 0;
20+
21+
// The component's internal status is unknown.
22+
COMMUNICATION_COMPONENT_STATE_CODE_UNKNOWN = 1;
23+
24+
// The component is powered on and responding to network traffic.
25+
COMMUNICATION_COMPONENT_STATE_CODE_ONLINE = 2;
26+
27+
// The component is powered off, unreachable, or administratively disabled.
28+
COMMUNICATION_COMPONENT_STATE_CODE_OFFLINE = 3;
29+
30+
// The component is up but experiencing degraded performance (e.g., high packet loss).
31+
COMMUNICATION_COMPONENT_STATE_CODE_DEGRADED = 4;
32+
33+
// The component is in the process of establishing connections.
34+
COMMUNICATION_COMPONENT_STATE_CODE_CONNECTING = 5;
35+
36+
// The component is in the process of shutting down connections.
37+
COMMUNICATION_COMPONENT_STATE_CODE_DISCONNECTING = 6;
38+
39+
// The component is undergoing maintenance (e.g., firmware upgrade).
40+
COMMUNICATION_COMPONENT_STATE_CODE_MAINTENANCE = 7;
41+
}
42+
1543
// Enumerated diagnostic codes for communication components.
1644
//
1745
// These codes indicate common network- or device-level faults that may affect
@@ -47,6 +75,37 @@ enum CommunicationComponentDiagnosticCode {
4775
COMMUNICATION_COMPONENT_DIAGNOSTIC_CODE_OVER_TEMPERATURE = 7;
4876
}
4977

78+
// A single snapshot of a communication component's state, diagnostics, and timing.
79+
//
80+
// !!! note "snapshot semantics"
81+
// all fields in this message represent the component's view at one point
82+
// in time, so there is only a single `snapshot_time`. any parallel reads
83+
// happening to produce this data are collapsed under that timestamp.
84+
message CommunicationComponentStateSnapshot {
85+
// the utc time when this snapshot was taken.
86+
google.protobuf.timestamp snapshot_time = 1;
87+
88+
// one or more high-level state codes active at snapshot_time.
89+
//
90+
// !!! note
91+
// typical usage is a single state (e.g., online), but multiple may
92+
// apply (e.g., connecting + degraded) if that makes sense.
93+
repeated CommunicationComponentStateCode states = 2;
94+
95+
// non-critical warnings detected for the component.
96+
//
97+
// !!! note
98+
// warnings may coexist with an online state, indicating potential
99+
// issues that do not prevent basic operation.
100+
repeated CommunicationComponentDiagnostic warnings = 3;
101+
102+
// critical errors currently affecting the component.
103+
//
104+
// !!! note
105+
// an error state code should accompany entries here.
106+
repeated CommunicationComponentDiagnostic errors = 4;
107+
}
108+
50109
// Represents an error or warning condition reported by a microgrid
51110
// communication component.
52111
//

0 commit comments

Comments
 (0)