Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: draft PR for discussing approach #44

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions alerting-config-service-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

option java_multiple_files = true;

package org.hypertrace.alerting.config.service.v1;

message MetricAnomalyEventCondition {

}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
44 changes: 44 additions & 0 deletions notification-channel-config-service-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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 {}
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")