github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/ruler/ruler.proto (about) 1 // Ruler Service Representation 2 // This service is used to retrieve the current state of rules running across 3 // all Rulers in a cluster. It allows cortex to fully serve the `/api/v1/{rules|alerts}` 4 // Prometheus API 5 syntax = "proto3"; 6 package ruler; 7 8 import "github.com/gogo/protobuf/gogoproto/gogo.proto"; 9 import "google/protobuf/duration.proto"; 10 import "google/protobuf/timestamp.proto"; 11 import "github.com/cortexproject/cortex/pkg/cortexpb/cortex.proto"; 12 import "github.com/cortexproject/cortex/pkg/ruler/rulespb/rules.proto"; 13 14 15 option (gogoproto.marshaler_all) = true; 16 option (gogoproto.unmarshaler_all) = true; 17 18 service Ruler { 19 rpc Rules(RulesRequest) returns (RulesResponse) {}; 20 } 21 22 message RulesRequest {} 23 24 message RulesResponse { 25 repeated GroupStateDesc groups = 1; 26 } 27 28 // GroupStateDesc is a proto representation of a cortex rule group 29 message GroupStateDesc { 30 rules.RuleGroupDesc group = 1; 31 repeated RuleStateDesc active_rules = 2; 32 google.protobuf.Timestamp evaluationTimestamp = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 33 google.protobuf.Duration evaluationDuration = 4 [(gogoproto.nullable) = false,(gogoproto.stdduration) = true]; 34 } 35 36 // RuleStateDesc is a proto representation of a Prometheus Rule 37 message RuleStateDesc { 38 rules.RuleDesc rule = 1; 39 string state = 2; 40 string health = 3; 41 string lastError = 4; 42 repeated AlertStateDesc alerts = 5; 43 google.protobuf.Timestamp evaluationTimestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 44 google.protobuf.Duration evaluationDuration = 7 [(gogoproto.nullable) = false,(gogoproto.stdduration) = true]; 45 } 46 47 message AlertStateDesc { 48 string state = 1; 49 repeated cortexpb.LabelPair labels = 2 [ 50 (gogoproto.nullable) = false, 51 (gogoproto.customtype) = "github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter" 52 ]; 53 repeated cortexpb.LabelPair annotations = 3 [ 54 (gogoproto.nullable) = false, 55 (gogoproto.customtype) = "github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter" 56 ]; 57 double value = 4; 58 google.protobuf.Timestamp active_at = 5 59 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 60 google.protobuf.Timestamp fired_at = 6 61 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 62 google.protobuf.Timestamp resolved_at = 7 63 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 64 google.protobuf.Timestamp last_sent_at = 8 65 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 66 google.protobuf.Timestamp valid_until = 9 67 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 68 }