Skip to content

Commit

Permalink
add support for notification_center (#81)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
liranco4 authored Dec 3, 2024
1 parent 5665e35 commit 45d3a3d
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 5 deletions.
1 change: 1 addition & 0 deletions com/coralogixapis/alerts/v3/alert_def.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 8 additions & 0 deletions com/coralogixapis/alerts/v3/commons.proto
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;
import "google/protobuf/wrappers.proto";

message LogsImmediateNotification {}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
36 changes: 36 additions & 0 deletions com/coralogixapis/alerts/v3/notification/notification_event.proto
Original file line number Diff line number Diff line change
@@ -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<string, string> key_values = 4;
oneof details {
LogsImmediateNotification logs_immediate = 100;
LogsThresholdNotification logs_threshold = 101;
MetricThresholdNotification metric_threshold = 102;
}
}

message Attachments {
google.protobuf.StringValue logExample = 1;
}

0 comments on commit 45d3a3d

Please sign in to comment.