From 3a72082c62a7a8a8678b18130a7eecc5bf47336b Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Fri, 5 Dec 2025 11:49:20 +1000 Subject: [PATCH] Update severity --- events.proto | 7 ++-- internal/server/mock/events/server.go | 9 ++++- pb/events.pb.go | 56 ++++++++++++++------------- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/events.proto b/events.proto index 4a62ca1..380c646 100644 --- a/events.proto +++ b/events.proto @@ -18,9 +18,10 @@ message Event { string ID = 1; // Event identifier google.protobuf.Timestamp Timestamp = 2; // When the event occurred enum EventSeverity { - Normal = 0; // Default type is normal - Warning = 1; // The event was a warning - Error = 2; // The event was an error + Info = 0; // Default type is normal informational events occur. + Warning = 1; // Used when something unusual happened eg. A config was deleted + Error = 2; // A failure has occured eg. Elevated error rates detected + Critical = 3; // Used when a critical failure has occured eg. Environment is down or a security breach detected } EventSeverity Severity = 3; // What type of event it is (e.g., Warning, Normal) string Type = 4; // The reason for the event (e.g., BackupSucceeded, ShellProvisioned) diff --git a/internal/server/mock/events/server.go b/internal/server/mock/events/server.go index 2f1aa4c..7399382 100644 --- a/internal/server/mock/events/server.go +++ b/internal/server/mock/events/server.go @@ -19,7 +19,7 @@ var mockEvents = []*pb.Event{ { Timestamp: timestamppb.New(time.Date(2025, 3, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute)), ID: "ABCDXXXX", - Severity: pb.Event_Normal, + Severity: pb.Event_Info, Type: "ConfigSet", Message: "A config was set: api.key", }, @@ -37,6 +37,13 @@ var mockEvents = []*pb.Event{ Type: "BackupFailed", Message: "The following backup failed with the ID: xxxxxxxxxxxxxxxxx", }, + { + Timestamp: timestamppb.New(time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC).Round(time.Minute)), + ID: "ABCDWWWW", + Severity: pb.Event_Critical, + Type: "EnvironmentDown", + Message: "The environment is down due to a critical failure", + }, } // Get the list of events from the server. diff --git a/pb/events.pb.go b/pb/events.pb.go index 6ccb423..df341e9 100644 --- a/pb/events.pb.go +++ b/pb/events.pb.go @@ -26,22 +26,25 @@ const ( type Event_EventSeverity int32 const ( - Event_Normal Event_EventSeverity = 0 // Default type is normal - Event_Warning Event_EventSeverity = 1 // The event was a warning - Event_Error Event_EventSeverity = 2 // The event was an error + Event_Info Event_EventSeverity = 0 // Default type is normal informational events occur. + Event_Warning Event_EventSeverity = 1 // Used when something unusual happened eg. A config was deleted + Event_Error Event_EventSeverity = 2 // A failure has occured eg. Elevated error rates detected + Event_Critical Event_EventSeverity = 3 // Used when a critical failure has occured eg. Environment is down or a security breach detected ) // Enum value maps for Event_EventSeverity. var ( Event_EventSeverity_name = map[int32]string{ - 0: "Normal", + 0: "Info", 1: "Warning", 2: "Error", + 3: "Critical", } Event_EventSeverity_value = map[string]int32{ - "Normal": 0, - "Warning": 1, - "Error": 2, + "Info": 0, + "Warning": 1, + "Error": 2, + "Critical": 3, } ) @@ -136,7 +139,7 @@ func (x *Event) GetSeverity() Event_EventSeverity { if x != nil { return x.Severity } - return Event_Normal + return Event_Info } func (x *Event) GetType() string { @@ -257,7 +260,7 @@ var file_events_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xef, 0x01, 0x0a, 0x05, 0x45, 0x76, + 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x38, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, @@ -269,23 +272,24 @@ var file_events_proto_rawDesc = []byte{ 0x53, 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x33, 0x0a, 0x0d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, - 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d, 0x61, - 0x6c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x01, - 0x12, 0x09, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x22, 0x35, 0x0a, 0x11, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, - 0x6e, 0x74, 0x22, 0x3d, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x06, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, - 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x32, 0x4d, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x43, 0x0a, 0x04, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1c, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3f, 0x0a, 0x0d, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x53, + 0x65, 0x76, 0x65, 0x72, 0x69, 0x74, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x10, + 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x09, + 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x72, 0x69, + 0x74, 0x69, 0x63, 0x61, 0x6c, 0x10, 0x03, 0x22, 0x35, 0x0a, 0x11, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, + 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x3d, + 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x06, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x4d, 0x0a, + 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x43, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x1b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x77, + 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (