Skip to content

Commit 386b40e

Browse files
committed
draft: draft PR for discussing approach
1 parent 496cb66 commit 386b40e

File tree

9 files changed

+288
-0
lines changed

9 files changed

+288
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import com.google.protobuf.gradle.generateProtoTasks
2+
import com.google.protobuf.gradle.id
3+
import com.google.protobuf.gradle.ofSourceSet
4+
import com.google.protobuf.gradle.plugins
5+
import com.google.protobuf.gradle.protobuf
6+
import com.google.protobuf.gradle.protoc
7+
8+
plugins {
9+
`java-library`
10+
id("com.google.protobuf") version "0.8.15"
11+
id("org.hypertrace.publish-plugin")
12+
}
13+
14+
protobuf {
15+
protoc {
16+
artifact = "com.google.protobuf:protoc:3.15.7"
17+
}
18+
plugins {
19+
id("grpc") {
20+
artifact = "io.grpc:protoc-gen-grpc-java:1.37.0"
21+
}
22+
}
23+
generateProtoTasks {
24+
ofSourceSet("main").forEach { task ->
25+
task.plugins {
26+
id("grpc")
27+
}
28+
}
29+
}
30+
}
31+
32+
dependencies {
33+
api("io.grpc:grpc-protobuf:1.37.0")
34+
api("io.grpc:grpc-stub:1.37.0")
35+
api("javax.annotation:javax.annotation-api:1.3.2")
36+
}
37+
38+
sourceSets {
39+
main {
40+
java {
41+
srcDirs("build/generated/source/proto/main/java", "build/generated/source/proto/main/grpc")
42+
}
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
option java_multiple_files = true;
4+
5+
package org.hypertrace.alerting.config.service.v1;
6+
7+
message EventAnomalyEventCondition {
8+
string event_category = 1;
9+
repeated EventCondition event_conditions = 2;
10+
}
11+
12+
message EventCondition {
13+
string event_type = 1;
14+
string event_value = 2;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
syntax = "proto3";
2+
3+
option java_multiple_files = true;
4+
5+
package org.hypertrace.alerting.config.service.v1;
6+
7+
message MetricAnomalyEventCondition {
8+
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
syntax = "proto3";
2+
3+
option java_multiple_files = true;
4+
5+
package org.hypertrace.alerting.config.service.v1;
6+
7+
import "org/hypertrace/alerting/config/service/v1/notification_rule.proto";
8+
9+
service NotificationRuleConfigService {
10+
rpc CreateNotificationRule(CreateNotificationRuleRequest) returns (CreateNotificationRuleResponse) {}
11+
rpc UpdateNotificationRule(UpdateNotificationRuleRequest) returns (UpdateNotificationRuleResponse) {}
12+
rpc GetAllNotificationRules(GetAllNotificationRulesRequest) returns (GetAllNotificationRulesResponse) {}
13+
rpc DeleteNotificationRule(DeleteNotificationRuleRequest) returns (DeleteNotificationRuleResponse) {}
14+
}
15+
16+
message CreateNotificationRuleRequest {
17+
NewNotificationRule new_notification_rule = 1;
18+
}
19+
20+
message CreateNotificationRuleResponse {
21+
NotificationRule notification_rule = 1;
22+
}
23+
24+
message UpdateNotificationRuleRequest {
25+
NotificationRule notification_rule = 1;
26+
}
27+
28+
message UpdateNotificationRuleResponse {
29+
NotificationRule notification_rule = 1;
30+
}
31+
32+
message GetAllNotificationRulesRequest {}
33+
34+
message GetAllNotificationRulesResponse {
35+
repeated NotificationRule notification_rules = 1;
36+
}
37+
38+
message DeleteNotificationRuleRequest {
39+
string notification_rule_id = 1;
40+
}
41+
42+
message DeleteNotificationRuleResponse {}
43+
44+
message GetNotificationRulesResponse {
45+
repeated NotificationRule notification_rules = 1;
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
syntax = "proto3";
2+
3+
option java_multiple_files = true;
4+
5+
package org.hypertrace.alerting.config.service.v1;
6+
7+
import "org/hypertrace/alerting/config/service/v1/metric_anomaly_event_condition.proto";
8+
import "org/hypertrace/alerting/config/service/v1/event_anomaly_event_condition.proto";
9+
10+
message NewNotificationRule {
11+
string rule_name = 1;
12+
string description = 2;
13+
repeated Labels labels = 3;
14+
EventConditions event_conditions = 4;
15+
string channel_id = 5;
16+
string rate_limit_interval_duration = 6;
17+
}
18+
19+
message NotificationRule {
20+
string id = 1;
21+
string rule_name = 2;
22+
string description = 3;
23+
repeated Labels labels = 4;
24+
25+
EventConditions event_conditions = 5;
26+
string channel_id = 6;
27+
string rate_limit_interval_duration = 7;
28+
}
29+
30+
message Labels {
31+
string key = 1;
32+
string value = 2;
33+
}
34+
35+
message EventConditions {
36+
oneof condition {
37+
MetricAnomalyEventCondition metric_anomaly_condition = 2;
38+
EventAnomalyEventCondition event_anomaly_condition = 3;
39+
}
40+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import com.google.protobuf.gradle.generateProtoTasks
2+
import com.google.protobuf.gradle.id
3+
import com.google.protobuf.gradle.ofSourceSet
4+
import com.google.protobuf.gradle.plugins
5+
import com.google.protobuf.gradle.protobuf
6+
import com.google.protobuf.gradle.protoc
7+
8+
plugins {
9+
`java-library`
10+
id("com.google.protobuf") version "0.8.15"
11+
id("org.hypertrace.publish-plugin")
12+
}
13+
14+
protobuf {
15+
protoc {
16+
artifact = "com.google.protobuf:protoc:3.15.7"
17+
}
18+
plugins {
19+
id("grpc") {
20+
artifact = "io.grpc:protoc-gen-grpc-java:1.37.0"
21+
}
22+
}
23+
generateProtoTasks {
24+
ofSourceSet("main").forEach { task ->
25+
task.plugins {
26+
id("grpc")
27+
}
28+
}
29+
}
30+
}
31+
32+
dependencies {
33+
api("io.grpc:grpc-protobuf:1.37.0")
34+
api("io.grpc:grpc-stub:1.37.0")
35+
api("javax.annotation:javax.annotation-api:1.3.2")
36+
}
37+
38+
sourceSets {
39+
main {
40+
java {
41+
srcDirs("build/generated/source/proto/main/java", "build/generated/source/proto/main/grpc")
42+
}
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
syntax = "proto3";
2+
3+
option java_multiple_files = true;
4+
5+
package org.hypertrace.notification.channel.config.service.v1;
6+
7+
message NewNotificationChannel {
8+
string channel_name = 1;
9+
NotificationChannelConfig notification_channel_config = 3;
10+
}
11+
12+
message NotificationChannel {
13+
string id = 1;
14+
string channel_name = 2;
15+
NotificationChannelConfig notification_channel_config = 4;
16+
}
17+
18+
message NotificationChannelConfig {
19+
repeated EmailChannelConfig email_channel_config = 1;
20+
repeated WebhookChannelConfig webhook_channel_config = 2;
21+
}
22+
23+
enum WebhookFormat {
24+
WEBHOOK_FORMAT_UNSPECIFIED = 0;
25+
WEBHOOK_FORMAT_SLACK = 1;
26+
WEBHOOK_FORMAT_JSON = 2;
27+
}
28+
29+
message WebhookChannelConfig {
30+
string url = 1;
31+
WebhookFormat format = 2;
32+
}
33+
34+
message EmailChannelConfig {
35+
string address = 1;
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
syntax = "proto3";
2+
3+
option java_multiple_files = true;
4+
5+
package org.hypertrace.notification.channel.config.service.v1;
6+
7+
import "org/hypertrace/notification/channel/config/service/v1/notification_channel.proto";
8+
9+
service NotificationChannelConfigService {
10+
rpc CreateNotificationChannel(CreateNotificationChannelRequest) returns (CreateNotificationChannelResponse) {}
11+
rpc UpdateNotificationChannel(UpdateNotificationChannelRequest) returns (UpdateNotificationChannelResponse) {}
12+
rpc GetAllNotificationChannels(GetAllNotificationChannelsRequest) returns (GetAllNotificationChannelsResponse) {}
13+
rpc DeleteNotificationChannel(DeleteNotificationChannelRequest) returns (DeleteNotificationChannelResponse) {}
14+
}
15+
16+
message CreateNotificationChannelRequest {
17+
NewNotificationChannel new_notification_channel = 1;
18+
}
19+
20+
message CreateNotificationChannelResponse {
21+
NotificationChannel notification_channel = 1;
22+
}
23+
24+
message UpdateNotificationChannelRequest {
25+
NotificationChannel notification_channel = 1;
26+
}
27+
28+
message UpdateNotificationChannelResponse {
29+
NotificationChannel notification_channel = 1;
30+
}
31+
32+
message GetAllNotificationChannelsRequest {}
33+
34+
message GetAllNotificationChannelsResponse {
35+
repeated NotificationChannel notification_channels = 1;
36+
}
37+
38+
message GetNotificationChannelRequest {
39+
string notification_channel_id = 1;
40+
}
41+
42+
message GetNotificationChannelResponse {
43+
NotificationChannel notification_channel = 1;
44+
}
45+
46+
message DeleteNotificationChannelRequest {
47+
string notification_channel_id = 1;
48+
}
49+
50+
message DeleteNotificationChannelResponse {}

settings.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ include(":config-proto-converter")
2020

2121
include(":spaces-config-service-api")
2222
include(":spaces-config-service-impl")
23+
24+
25+
include(":alerting-config-service-api")
26+
include(":notification-channel-config-service-api")

0 commit comments

Comments
 (0)