diff --git a/alerting-config-service-api/build.gradle.kts b/alerting-config-service-api/build.gradle.kts new file mode 100644 index 00000000..ab7e8454 --- /dev/null +++ b/alerting-config-service-api/build.gradle.kts @@ -0,0 +1,44 @@ +import com.google.protobuf.gradle.generateProtoTasks +import com.google.protobuf.gradle.id +import com.google.protobuf.gradle.ofSourceSet +import com.google.protobuf.gradle.plugins +import com.google.protobuf.gradle.protobuf +import com.google.protobuf.gradle.protoc + +plugins { + `java-library` + id("com.google.protobuf") version "0.8.15" + id("org.hypertrace.publish-plugin") +} + +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:3.15.7" + } + plugins { + id("grpc") { + artifact = "io.grpc:protoc-gen-grpc-java:1.37.0" + } + } + generateProtoTasks { + ofSourceSet("main").forEach { task -> + task.plugins { + id("grpc") + } + } + } +} + +dependencies { + api("io.grpc:grpc-protobuf:1.37.0") + api("io.grpc:grpc-stub:1.37.0") + api("javax.annotation:javax.annotation-api:1.3.2") +} + +sourceSets { + main { + java { + srcDirs("build/generated/source/proto/main/java", "build/generated/source/proto/main/grpc") + } + } +} diff --git a/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/event_anomaly_event_condition.proto b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/event_anomaly_event_condition.proto new file mode 100644 index 00000000..21bcf846 --- /dev/null +++ b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/event_anomaly_event_condition.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +option java_multiple_files = true; + +package org.hypertrace.alerting.config.service.v1; + +message EventAnomalyEventCondition { + string event_category = 1; + repeated EventCondition event_conditions = 2; +} + +message EventCondition { + string event_type = 1; + string event_value = 2; +} diff --git a/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/metric_anomaly_event_condition.proto b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/metric_anomaly_event_condition.proto new file mode 100644 index 00000000..ddaff74b --- /dev/null +++ b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/metric_anomaly_event_condition.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +option java_multiple_files = true; + +package org.hypertrace.alerting.config.service.v1; + +message MetricAnomalyEventCondition { + +} diff --git a/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/notification_config_service.proto b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/notification_config_service.proto new file mode 100644 index 00000000..03685366 --- /dev/null +++ b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/notification_config_service.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +option java_multiple_files = true; + +package org.hypertrace.alerting.config.service.v1; + +import "org/hypertrace/alerting/config/service/v1/notification_rule.proto"; + +service NotificationRuleConfigService { + rpc CreateNotificationRule(CreateNotificationRuleRequest) returns (CreateNotificationRuleResponse) {} + rpc UpdateNotificationRule(UpdateNotificationRuleRequest) returns (UpdateNotificationRuleResponse) {} + rpc GetAllNotificationRules(GetAllNotificationRulesRequest) returns (GetAllNotificationRulesResponse) {} + rpc DeleteNotificationRule(DeleteNotificationRuleRequest) returns (DeleteNotificationRuleResponse) {} +} + +message CreateNotificationRuleRequest { + NewNotificationRule new_notification_rule = 1; +} + +message CreateNotificationRuleResponse { + NotificationRule notification_rule = 1; +} + +message UpdateNotificationRuleRequest { + NotificationRule notification_rule = 1; +} + +message UpdateNotificationRuleResponse { + NotificationRule notification_rule = 1; +} + +message GetAllNotificationRulesRequest {} + +message GetAllNotificationRulesResponse { + repeated NotificationRule notification_rules = 1; +} + +message DeleteNotificationRuleRequest { + string notification_rule_id = 1; +} + +message DeleteNotificationRuleResponse {} + +message GetNotificationRulesResponse { + repeated NotificationRule notification_rules = 1; +} diff --git a/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/notification_rule.proto b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/notification_rule.proto new file mode 100644 index 00000000..248caa1e --- /dev/null +++ b/alerting-config-service-api/src/main/proto/org/hypertrace/alerting/config/service/v1/notification_rule.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; + +option java_multiple_files = true; + +package org.hypertrace.alerting.config.service.v1; + +import "org/hypertrace/alerting/config/service/v1/metric_anomaly_event_condition.proto"; +import "org/hypertrace/alerting/config/service/v1/event_anomaly_event_condition.proto"; + +message NewNotificationRule { + string rule_name = 1; + string description = 2; + repeated Labels labels = 3; + EventConditions event_conditions = 4; + string channel_id = 5; + string rate_limit_interval_duration = 6; +} + +message NotificationRule { + string id = 1; + string rule_name = 2; + string description = 3; + repeated Labels labels = 4; + + EventConditions event_conditions = 5; + string channel_id = 6; + string rate_limit_interval_duration = 7; +} + +message Labels { + string key = 1; + string value = 2; +} + +message EventConditions { + oneof condition { + MetricAnomalyEventCondition metric_anomaly_condition = 2; + EventAnomalyEventCondition event_anomaly_condition = 3; + } +} diff --git a/notification-channel-config-service-api/build.gradle.kts b/notification-channel-config-service-api/build.gradle.kts new file mode 100644 index 00000000..ab7e8454 --- /dev/null +++ b/notification-channel-config-service-api/build.gradle.kts @@ -0,0 +1,44 @@ +import com.google.protobuf.gradle.generateProtoTasks +import com.google.protobuf.gradle.id +import com.google.protobuf.gradle.ofSourceSet +import com.google.protobuf.gradle.plugins +import com.google.protobuf.gradle.protobuf +import com.google.protobuf.gradle.protoc + +plugins { + `java-library` + id("com.google.protobuf") version "0.8.15" + id("org.hypertrace.publish-plugin") +} + +protobuf { + protoc { + artifact = "com.google.protobuf:protoc:3.15.7" + } + plugins { + id("grpc") { + artifact = "io.grpc:protoc-gen-grpc-java:1.37.0" + } + } + generateProtoTasks { + ofSourceSet("main").forEach { task -> + task.plugins { + id("grpc") + } + } + } +} + +dependencies { + api("io.grpc:grpc-protobuf:1.37.0") + api("io.grpc:grpc-stub:1.37.0") + api("javax.annotation:javax.annotation-api:1.3.2") +} + +sourceSets { + main { + java { + srcDirs("build/generated/source/proto/main/java", "build/generated/source/proto/main/grpc") + } + } +} diff --git a/notification-channel-config-service-api/src/main/proto/org/hypertrace/notification/channel/config/service/v1/notification_channel.proto b/notification-channel-config-service-api/src/main/proto/org/hypertrace/notification/channel/config/service/v1/notification_channel.proto new file mode 100644 index 00000000..c837005c --- /dev/null +++ b/notification-channel-config-service-api/src/main/proto/org/hypertrace/notification/channel/config/service/v1/notification_channel.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +option java_multiple_files = true; + +package org.hypertrace.notification.channel.config.service.v1; + +message NewNotificationChannel { + string channel_name = 1; + NotificationChannelConfig notification_channel_config = 3; +} + +message NotificationChannel { + string id = 1; + string channel_name = 2; + NotificationChannelConfig notification_channel_config = 4; +} + +message NotificationChannelConfig { + repeated EmailChannelConfig email_channel_config = 1; + repeated WebhookChannelConfig webhook_channel_config = 2; +} + +enum WebhookFormat { + WEBHOOK_FORMAT_UNSPECIFIED = 0; + WEBHOOK_FORMAT_SLACK = 1; + WEBHOOK_FORMAT_JSON = 2; +} + +message WebhookChannelConfig { + string url = 1; + WebhookFormat format = 2; +} + +message EmailChannelConfig { + string address = 1; +} diff --git a/notification-channel-config-service-api/src/main/proto/org/hypertrace/notification/channel/config/service/v1/notification_channel_config_service.proto b/notification-channel-config-service-api/src/main/proto/org/hypertrace/notification/channel/config/service/v1/notification_channel_config_service.proto new file mode 100644 index 00000000..4e727d44 --- /dev/null +++ b/notification-channel-config-service-api/src/main/proto/org/hypertrace/notification/channel/config/service/v1/notification_channel_config_service.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; + +option java_multiple_files = true; + +package org.hypertrace.notification.channel.config.service.v1; + +import "org/hypertrace/notification/channel/config/service/v1/notification_channel.proto"; + +service NotificationChannelConfigService { + rpc CreateNotificationChannel(CreateNotificationChannelRequest) returns (CreateNotificationChannelResponse) {} + rpc UpdateNotificationChannel(UpdateNotificationChannelRequest) returns (UpdateNotificationChannelResponse) {} + rpc GetAllNotificationChannels(GetAllNotificationChannelsRequest) returns (GetAllNotificationChannelsResponse) {} + rpc DeleteNotificationChannel(DeleteNotificationChannelRequest) returns (DeleteNotificationChannelResponse) {} +} + +message CreateNotificationChannelRequest { + NewNotificationChannel new_notification_channel = 1; +} + +message CreateNotificationChannelResponse { + NotificationChannel notification_channel = 1; +} + +message UpdateNotificationChannelRequest { + NotificationChannel notification_channel = 1; +} + +message UpdateNotificationChannelResponse { + NotificationChannel notification_channel = 1; +} + +message GetAllNotificationChannelsRequest {} + +message GetAllNotificationChannelsResponse { + repeated NotificationChannel notification_channels = 1; +} + +message GetNotificationChannelRequest { + string notification_channel_id = 1; +} + +message GetNotificationChannelResponse { + NotificationChannel notification_channel = 1; +} + +message DeleteNotificationChannelRequest { + string notification_channel_id = 1; +} + +message DeleteNotificationChannelResponse {} diff --git a/settings.gradle.kts b/settings.gradle.kts index 1737d234..74d5ea75 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -20,3 +20,7 @@ include(":config-proto-converter") include(":spaces-config-service-api") include(":spaces-config-service-impl") + + +include(":alerting-config-service-api") +include(":notification-channel-config-service-api")