Skip to content

Commit

Permalink
Alert types v3 reloaded (#68)
Browse files Browse the repository at this point in the history
* add condition type to alert type

* small naming fixes

* aa

* some comments

* v3 and v3_5 for better migration in alerts-api
v3 should be deleted and v3_5 should be v3 once we're done

* putting all the override in comment since the feature is not out

* deleting v3 and getting back event

* changing back from v35 to v3

* moving files around and changing alotttt of names

* changing name of unique count

* unusual condition type

* enum names more accurate

* removing comments and changing to rules instead of rule

---------

Co-authored-by: Ofir Tadmor <[email protected]>
Co-authored-by: Alex-Tara <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent c0b8998 commit 832258e
Show file tree
Hide file tree
Showing 56 changed files with 355 additions and 370 deletions.
83 changes: 35 additions & 48 deletions com/coralogixapis/alerts/v3/alert_def.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,38 @@ syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "com/coralogixapis/alerts/v3/alert_def_scheduling.proto";
import "com/coralogixapis/alerts/v3/alert_def_notification_group.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/standard/logs_immediate_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/standard/logs_more_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/standard/logs_less_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/standard/logs_more_than_usual_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/standard/logs_less_than_usual_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/ratio/logs_ratio_more_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/ratio/logs_ratio_less_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/new_value/logs_new_value_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/unique_count/unique_count_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/time_relative/logs_time_relative_more_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/time_relative/logs_time_relative_less_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_more_than_eq_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_less_than_eq_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_less_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_more_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_more_than_usual_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_less_than_usual_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/tracing/tracing_immediate_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/tracing/tracing_more_than_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/flow/flow_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type.proto";
import "com/coralogixapis/alerts/v3/alert_def_priority.proto";
import "com/coralogixapis/alerts/v3/alert_def_scheduling.proto";
import "com/coralogixapis/alerts/v3/alert_def_type.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/flow/flow_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_threshold_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/metric/metric_unusual_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_new_value_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_ratio_threshold_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_immediate_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_threshold_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_unusual_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_time_relative_threshold_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/tracing/tracing_immediate_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/tracing/tracing_threshold_type_definition.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/logs_unique_count_type_definition.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

/**
* Represents An Existing or Created Alert Definition
* Represents An Existing or Created Alert Definition
*/
message AlertDef {
AlertDefProperties alert_def_properties = 1;
google.protobuf.StringValue id = 2; // This is the Alert Definition's Persistent ID (does not change on replace) , AKA UniqueIdentifier
google.protobuf.StringValue alert_version_id = 20; // the old alertId
google.protobuf.Timestamp created_time = 3;
google.protobuf.Timestamp updated_time = 4;
}

/**
* Represents The non generated alert definition properties (the ones that are set by the user)
* Represents The non generated alert definition properties (the ones that are set by the user)
*/
message AlertDefProperties {
google.protobuf.StringValue name = 1;
Expand All @@ -50,31 +43,25 @@ message AlertDefProperties {
oneof schedule {
ActivitySchedule active_on = 5;
}
AlertDefType alert_def_type = 6;
AlertDefType type = 6;
oneof type_definition {
LogsImmediateTypeDefinition logs_immediate = 100;
LogsMoreThanTypeDefinition logs_more_than = 101;
LogsLessThanTypeDefinition logs_less_than = 102;
LogsMoreThanUsualTypeDefinition logs_more_than_usual = 103;
LogsRatioMoreThanTypeDefinition logs_ratio_more_than = 104;
LogsRatioLessThanTypeDefinition logs_ratio_less_than = 105;
LogsNewValueTypeDefinition logs_new_value = 106;
LogsUniqueCountTypeDefinition logs_unique_count = 107;
LogsTimeRelativeMoreThanTypeDefinition logs_time_relative_more_than = 108;
LogsTimeRelativeLessThanTypeDefinition logs_time_relative_less_than = 109;
MetricMoreThanTypeDefinition metric_more_than = 112;
MetricLessThanTypeDefinition metric_less_than = 113;
MetricMoreThanUsualTypeDefinition metric_more_than_usual = 114;
TracingImmediateTypeDefinition tracing_immediate = 115;
TracingMoreThanTypeDefinition tracing_more_than = 116;
FlowTypeDefinition flow = 117;
MetricLessThanUsualTypeDefinition metric_less_than_usual = 118;
MetricMoreThanOrEqualsTypeDefinition metric_more_than_or_equals = 119;
MetricLessThanOrEqualsTypeDefinition metric_less_than_or_equals = 120;
};
LogsImmediateType logs_immediate = 101;
TracingImmediateType tracing_immediate = 102;
LogsThresholdType logs_threshold = 103;
LogsRatioThresholdType logs_ratio_threshold = 104;
LogsTimeRelativeThresholdType logs_time_relative_threshold = 105;
MetricThresholdType metric_threshold = 106;
TracingThresholdType tracing_threshold = 107;
FlowType flow = 108;
LogsUnusualType logs_unusual = 109;
MetricUnusualType metric_unusual = 110;
LogsNewValueType logs_new_value = 111;
LogsUniqueCountType logs_unique_count = 112;
}
repeated google.protobuf.StringValue group_by = 7;
AlertDefIncidentSettings incidents_settings = 8;
AlertDefNotificationGroup notification_group = 9;
map<string,string> labels = 10;
map<string, string> labels = 10;
google.protobuf.BoolValue phantom_mode = 11;
google.protobuf.BoolValue deleted = 12;
}
2 changes: 1 addition & 1 deletion com/coralogixapis/alerts/v3/alert_def_priority.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ enum AlertDefPriority {
ALERT_DEF_PRIORITY_P3 = 2;
ALERT_DEF_PRIORITY_P2 = 3;
ALERT_DEF_PRIORITY_P1 = 4;
}
}
2 changes: 1 addition & 1 deletion com/coralogixapis/alerts/v3/alert_def_scheduling.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ message TimeOfDay {
int32 hours = 1;
// Minutes of hour of day. Must be from 0 to 59.
int32 minutes = 2;
}
}
21 changes: 7 additions & 14 deletions com/coralogixapis/alerts/v3/alert_def_type.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@ package com.coralogixapis.alerts.v3;

enum AlertDefType {
ALERT_DEF_TYPE_LOGS_IMMEDIATE_OR_UNSPECIFIED = 0;
ALERT_DEF_TYPE_LOGS_MORE_THAN = 1;
ALERT_DEF_TYPE_LOGS_LESS_THAN = 2;
ALERT_DEF_TYPE_LOGS_MORE_THAN_USUAL = 3;
ALERT_DEF_TYPE_LOGS_RATIO_MORE_THAN = 4;
ALERT_DEF_TYPE_LOGS_RATIO_LESS_THAN = 5;
ALERT_DEF_TYPE_LOGS_THRESHOLD = 1;
ALERT_DEF_TYPE_LOGS_UNUSUAL = 3;
ALERT_DEF_TYPE_LOGS_RATIO_THRESHOLD = 4;
ALERT_DEF_TYPE_LOGS_NEW_VALUE = 6;
ALERT_DEF_TYPE_LOGS_UNIQUE_COUNT = 7;
ALERT_DEF_TYPE_LOGS_TIME_RELATIVE_MORE_THAN = 8;
ALERT_DEF_TYPE_LOGS_TIME_RELATIVE_LESS_THAN = 9;
ALERT_DEF_TYPE_METRIC_MORE_THAN = 10;
ALERT_DEF_TYPE_METRIC_LESS_THAN = 11;
ALERT_DEF_TYPE_METRIC_MORE_THAN_USUAL = 14;
ALERT_DEF_TYPE_LOGS_TIME_RELATIVE_THRESHOLD = 8;
ALERT_DEF_TYPE_METRIC_THRESHOLD = 10;
ALERT_DEF_TYPE_METRIC_UNUSUAL = 14;
ALERT_DEF_TYPE_TRACING_IMMEDIATE = 15;
ALERT_DEF_TYPE_TRACING_MORE_THAN = 16;
ALERT_DEF_TYPE_TRACING_THRESHOLD = 16;
ALERT_DEF_TYPE_FLOW = 17;
ALERT_DEF_TYPE_METRIC_MORE_THAN_OR_EQUALS = 18;
ALERT_DEF_TYPE_METRIC_LESS_THAN_OR_EQUALS = 19;
ALERT_DEF_TYPE_METRIC_LESS_THAN_USUAL = 21;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ message ActivityAnalysis {
enum ActivityAnalysisStatus {
ACTIVITY_ANALYSIS_STATUS_ACTIVATE_OR_UNSPECIFIED = 0;
ACTIVITY_ANALYSIS_STATUS_MUTE = 1;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";

message FlowTypeDefinition {
message FlowType {
repeated FlowStages stages = 1 ;
google.protobuf.BoolValue enforce_suppression = 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import "google/protobuf/wrappers.proto";

message LogsFilter {
oneof filter_type {
LuceneFilter lucene_filter = 1;
// DPXL will be added here in the future
//google.protobuf.StringValue dpxl = 2;
LogsSimpleFilter simple_filter = 1;
}
}
message LuceneFilter {
message LogsSimpleFilter {
google.protobuf.StringValue lucene_query = 1;
LabelFilters label_filters = 2;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
syntax = "proto3";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs_filter.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";
import "google/protobuf/wrappers.proto";

package com.coralogixapis.alerts.v3;

message LogsImmediateTypeDefinition {
message LogsImmediateType {
LogsFilter logs_filter = 1;
repeated google.protobuf.StringValue notification_payload_filter = 2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/new_value/logs_new_value_timewindow.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";

message LogsNewValueType {
LogsFilter logs_filter = 1;
repeated LogsNewValueRule rules = 2;
repeated google.protobuf.StringValue notification_payload_filter = 3;
}
message LogsNewValueRule {
LogsNewValueCondition condition = 1;
}
message LogsNewValueCondition {
google.protobuf.StringValue keypath_to_track = 1;
LogsNewValueTimeWindow time_window = 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/ratio/logs_ratio_timewindow.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/undetected_values_management.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/ratio/logs_ratio_group_by_for.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/ratio/logs_ratio_condition_type.proto";

message LogsRatioThresholdType {
LogsFilter numerator = 1;
google.protobuf.StringValue numerator_alias =2;
LogsFilter denominator = 3;
google.protobuf.StringValue denominator_alias = 4;
repeated LogsRatioRules rules = 5;
repeated google.protobuf.StringValue notification_payload_filter = 6;
LogsRatioGroupByFor group_by_for = 7;
UndetectedValuesManagement undetected_values_management = 8;
}
message LogsRatioRules {
LogsRatioCondition condition = 1;
}

message LogsRatioCondition {
google.protobuf.DoubleValue threshold = 1;
LogsRatioTimeWindow time_window = 2;
google.protobuf.BoolValue ignore_infinity = 3;
LogsRatioConditionType condition_type = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/undetected_values_management.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_timewindow.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/threshold/logs_threshold_condition_type.proto";

message LogsThresholdType {
LogsFilter logs_filter = 1;
UndetectedValuesManagement undetected_values_management = 2;
repeated LogsThresholdRule rules = 3;
repeated google.protobuf.StringValue notification_payload_filter = 4;
}
message LogsThresholdRule {
LogsThresholdCondition condition = 1;
}

message LogsThresholdCondition {
google.protobuf.DoubleValue threshold = 1;
LogsTimeWindow time_window = 2;
LogsThresholdConditionType condition_type = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/time_relative/logs_time_relative_compared_to.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/undetected_values_management.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/time_relative/logs_time_relative_condition_type.proto";

message LogsTimeRelativeThresholdType {
LogsFilter logs_filter = 1;
repeated LogsTimeRelativeRule rules = 2;
repeated google.protobuf.StringValue notification_payload_filter = 4;
UndetectedValuesManagement undetected_values_management = 5;
}
message LogsTimeRelativeRule {
LogsTimeRelativeCondition condition = 1;
}

message LogsTimeRelativeCondition{
google.protobuf.DoubleValue threshold =1;
LogsTimeRelativeComparedTo compared_to = 2;
google.protobuf.BoolValue ignore_infinity = 3;
LogsTimeRelativeConditionType condition_type = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/unique_count/logs_unique_value_timewindow.proto";

message LogsUniqueCountType {
LogsFilter logs_filter = 1;
repeated LogsUniqueCountRule rules = 2;
repeated google.protobuf.StringValue notification_payload_filter = 3;
}

message LogsUniqueCountRule{
LogsUniqueCountCondition condition = 1;
}

message LogsUniqueCountCondition{
google.protobuf.StringValue unique_count_keypath = 1;
google.protobuf.Int64Value max_unique_count = 2;
LogsUniqueValueTimeWindow time_window = 3;
google.protobuf.Int64Value max_unique_count_per_group_by_key = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;

import "google/protobuf/wrappers.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_filter.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/common/logs_timewindow.proto";
import "com/coralogixapis/alerts/v3/alert_def_type_definition/logs/unusual/logs_unsual_condition_type.proto";

message LogsUnusualType {
LogsFilter logs_filter = 1;
repeated LogsUnusualRule rules = 2;
repeated google.protobuf.StringValue notification_payload_filter = 3;
}
message LogsUnusualRule {
LogsUnusualCondition condition = 1;
}

message LogsUnusualCondition {
google.protobuf.DoubleValue minimum_threshold = 1;
LogsTimeWindow time_window = 2;
LogsUnusualConditionType condition_type = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;


enum LogsRatioConditionType {
LOGS_RATIO_CONDITION_TYPE_MORE_THAN_OR_UNSPECIFIED = 0;
LOGS_RATIO_CONDITION_TYPE_LESS_THAN = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package com.coralogixapis.alerts.v3;


enum LogsThresholdConditionType {
LOGS_THRESHOLD_CONDITION_TYPE_MORE_THAN_OR_UNSPECIFIED = 0;
LOGS_THRESHOLD_CONDITION_TYPE_LESS_THAN = 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ enum LogsTimeRelativeComparedTo {
LOGS_TIME_RELATIVE_COMPARED_TO_YESTERDAY = 3;
LOGS_TIME_RELATIVE_COMPARED_TO_SAME_DAY_LAST_WEEK = 4;
LOGS_TIME_RELATIVE_COMPARED_TO_SAME_DAY_LAST_MONTH = 5;
}
}
Loading

0 comments on commit 832258e

Please sign in to comment.