From 45d3a3d02bd8b69fe408984bdbe1ea954c559475 Mon Sep 17 00:00:00 2001 From: CL Date: Tue, 3 Dec 2024 14:31:56 +0200 Subject: [PATCH] add support for notification_center (#81) * add support for notification_center * align to correct schema * add new schema for new notification event * remove logExample from any group * update version for supporting one destionation with two NotificationRouting * review by Zvika * reviewd by RLRL * final version --- com/coralogixapis/alerts/v3/alert_def.proto | 1 + .../v3/alert_def_notification_group.proto | 8 ++--- .../notification_destination.proto | 32 +++++++++++++++++ com/coralogixapis/alerts/v3/commons.proto | 8 +++++ .../logs_immediate_notification.proto | 6 ++++ .../logs_threshold_notification.proto | 14 ++++++++ .../metric_threshold_notification.proto | 17 +++++++++ .../v3/notification/notification_event.proto | 36 +++++++++++++++++++ 8 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 com/coralogixapis/alerts/v3/alert_def_type_definition/notification_destination.proto create mode 100644 com/coralogixapis/alerts/v3/commons.proto create mode 100644 com/coralogixapis/alerts/v3/notification/logs_immediate_notification.proto create mode 100644 com/coralogixapis/alerts/v3/notification/logs_threshold_notification.proto create mode 100644 com/coralogixapis/alerts/v3/notification/metric_threshold_notification.proto create mode 100644 com/coralogixapis/alerts/v3/notification/notification_event.proto diff --git a/com/coralogixapis/alerts/v3/alert_def.proto b/com/coralogixapis/alerts/v3/alert_def.proto index 0b5d04b..ca5245e 100644 --- a/com/coralogixapis/alerts/v3/alert_def.proto +++ b/com/coralogixapis/alerts/v3/alert_def.proto @@ -21,6 +21,7 @@ import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_unique_c import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; + /** * Represents An Existing or Created Alert Definition */ diff --git a/com/coralogixapis/alerts/v3/alert_def_notification_group.proto b/com/coralogixapis/alerts/v3/alert_def_notification_group.proto index 0e30029..cff642c 100644 --- a/com/coralogixapis/alerts/v3/alert_def_notification_group.proto +++ b/com/coralogixapis/alerts/v3/alert_def_notification_group.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package com.coralogixapis.alerts.v3; import "google/protobuf/wrappers.proto"; +import "com/coralogixapis/alerts/v3/commons.proto"; +import "com/coralogixapis/alerts/v3/alert_def_type_definition/notification_destination.proto"; message AlertDefIncidentSettings { oneof retriggering_period { @@ -14,6 +16,7 @@ message AlertDefIncidentSettings { message AlertDefNotificationGroup { repeated google.protobuf.StringValue group_by_keys = 1; repeated AlertDefWebhooksSettings webhooks = 2; + repeated NotificationDestination destinations = 3; } message AlertDefWebhooksSettings { @@ -34,8 +37,3 @@ message IntegrationType { message Recipients { repeated google.protobuf.StringValue emails = 1; } - -enum NotifyOn { - NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED = 0; - NOTIFY_ON_TRIGGERED_AND_RESOLVED = 1; -} diff --git a/com/coralogixapis/alerts/v3/alert_def_type_definition/notification_destination.proto b/com/coralogixapis/alerts/v3/alert_def_type_definition/notification_destination.proto new file mode 100644 index 0000000..da5e7cd --- /dev/null +++ b/com/coralogixapis/alerts/v3/alert_def_type_definition/notification_destination.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +import "com/coralogixapis/alerts/v3/commons.proto"; + +package com.coralogixapis.alerts.v3; + +message NotificationDestination { + string connector_id = 1; + optional string preset_id = 2; + NotifyOn notify_on = 3; + NotificationRouting triggeredRoutingOverrides = 4; + optional NotificationRouting resolvedRouteOverrides = 5; +} + +message NotificationRouting { + optional SourceOverrides config_overrides = 1; +} + +message SourceOverrides { + string output_schema_id = 1; + repeated MessageConfigField message_config_fields = 2; + repeated ConnectorConfigField connector_config_fields = 3; +} + +message ConnectorConfigField { + string field_name = 1; + string template = 2; +} + +message MessageConfigField { + string field_name = 1; + string template = 2; +} diff --git a/com/coralogixapis/alerts/v3/commons.proto b/com/coralogixapis/alerts/v3/commons.proto new file mode 100644 index 0000000..dde619c --- /dev/null +++ b/com/coralogixapis/alerts/v3/commons.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +package com.coralogixapis.alerts.v3; + +enum NotifyOn { + NOTIFY_ON_TRIGGERED_ONLY_UNSPECIFIED = 0; + NOTIFY_ON_TRIGGERED_AND_RESOLVED = 1; +} diff --git a/com/coralogixapis/alerts/v3/notification/logs_immediate_notification.proto b/com/coralogixapis/alerts/v3/notification/logs_immediate_notification.proto new file mode 100644 index 0000000..b253728 --- /dev/null +++ b/com/coralogixapis/alerts/v3/notification/logs_immediate_notification.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; + +package com.coralogixapis.alerts.v3; +import "google/protobuf/wrappers.proto"; + +message LogsImmediateNotification {} diff --git a/com/coralogixapis/alerts/v3/notification/logs_threshold_notification.proto b/com/coralogixapis/alerts/v3/notification/logs_threshold_notification.proto new file mode 100644 index 0000000..5b8daf0 --- /dev/null +++ b/com/coralogixapis/alerts/v3/notification/logs_threshold_notification.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package com.coralogixapis.alerts.v3; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/timestamp.proto"; +import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/threshold/logs_threshold_condition_type.proto"; + +message LogsThresholdNotification { + google.protobuf.Timestamp from_timestamp = 1; + google.protobuf.Timestamp to_timestamp = 2; + google.protobuf.Int64Value count_result = 3; + google.protobuf.BoolValue is_undetected_value = 4; + LogsThresholdConditionType condition_type = 5; +} diff --git a/com/coralogixapis/alerts/v3/notification/metric_threshold_notification.proto b/com/coralogixapis/alerts/v3/notification/metric_threshold_notification.proto new file mode 100644 index 0000000..f059c16 --- /dev/null +++ b/com/coralogixapis/alerts/v3/notification/metric_threshold_notification.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; + +package com.coralogixapis.alerts.v3; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/timestamp.proto"; +import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/threshold/metric_threshold_condition_type.proto"; + +message MetricThresholdNotification { + google.protobuf.DoubleValue pct_over_threshold = 1; + google.protobuf.DoubleValue avg_value_over_threshold = 2; + google.protobuf.DoubleValue min_value_over_threshold = 3; + google.protobuf.DoubleValue max_value_over_threshold = 4; + google.protobuf.BoolValue is_undetected_value = 5; + google.protobuf.Timestamp from_timestamp = 6; + google.protobuf.Timestamp to_timestamp = 7; + MetricThresholdConditionType condition_type = 8; +} diff --git a/com/coralogixapis/alerts/v3/notification/notification_event.proto b/com/coralogixapis/alerts/v3/notification/notification_event.proto new file mode 100644 index 0000000..c919a24 --- /dev/null +++ b/com/coralogixapis/alerts/v3/notification/notification_event.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package com.coralogixapis.alerts.v3; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "com/coralogixapis/alerts/v3/event/alert_event.proto"; +import "com/coralogixapis/alerts/v3/alert_def_priority.proto"; +import "com/coralogixapis/alerts/v3/notification/logs_immediate_notification.proto"; +import "com/coralogixapis/alerts/v3/notification/logs_threshold_notification.proto"; +import "com/coralogixapis/alerts/v3/notification/metric_threshold_notification.proto"; +import "com/coralogixapis/alerts/v3/alert_def.proto"; + +message AlertNotificationEvent { + google.protobuf.Timestamp timestamp = 1; + google.protobuf.StringValue id = 2; + AlertStatus status = 3; + Attachments attachments = 4; + repeated Group groups = 5; +} + +message Group { + AlertStatus status = 1; + google.protobuf.BoolValue suppressed = 2; + AlertDefPriority priority = 3; + map key_values = 4; + oneof details { + LogsImmediateNotification logs_immediate = 100; + LogsThresholdNotification logs_threshold = 101; + MetricThresholdNotification metric_threshold = 102; + } +} + +message Attachments { + google.protobuf.StringValue logExample = 1; +}