|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package metrics.v1; |
| 4 | + |
| 5 | +option go_package = "github.com/roadrunner-server/api-go/v6/metrics/v1;metricsV1"; |
| 6 | +option php_metadata_namespace = "RoadRunner\\Metrics\\DTO\\V1\\GPBMetadata"; |
| 7 | +option php_namespace = "RoadRunner\\Metrics\\DTO\\V1"; |
| 8 | + |
| 9 | +// CollectorType enumerates the supported Prometheus collector kinds. The |
| 10 | +// numeric values are stable; do not reuse or renumber. |
| 11 | +enum CollectorType { |
| 12 | + COLLECTOR_TYPE_UNSPECIFIED = 0; |
| 13 | + COLLECTOR_TYPE_HISTOGRAM = 1; |
| 14 | + COLLECTOR_TYPE_GAUGE = 2; |
| 15 | + COLLECTOR_TYPE_COUNTER = 3; |
| 16 | + COLLECTOR_TYPE_SUMMARY = 4; |
| 17 | +} |
| 18 | + |
| 19 | +// Objective is a single (quantile, error) pair for Prometheus summary |
| 20 | +// collectors. proto3 forbids float-keyed maps, so summary objectives are |
| 21 | +// modelled as a repeated message rather than `map<double, double>`. |
| 22 | +message Objective { |
| 23 | + double quantile = 1; |
| 24 | + double error = 2; |
| 25 | +} |
| 26 | + |
| 27 | +// Collector describes the shape of a single application-defined metric. |
| 28 | +// Mirrors github.com/roadrunner-server/metrics/v6.Collector. |
| 29 | +message Collector { |
| 30 | + string namespace = 1; |
| 31 | + string subsystem = 2; |
| 32 | + CollectorType type = 3; |
| 33 | + string help = 4; |
| 34 | + repeated string labels = 5; |
| 35 | + repeated double buckets = 6; |
| 36 | + repeated Objective objectives = 7; |
| 37 | +} |
| 38 | + |
| 39 | +// Metric is a single observation against an already-declared collector. |
| 40 | +message Metric { |
| 41 | + string name = 1; |
| 42 | + double value = 2; |
| 43 | + repeated string labels = 3; |
| 44 | +} |
| 45 | + |
| 46 | +// NamedCollector wraps a Collector with its registry name; used only by |
| 47 | +// Declare to register a new collector under that name. |
| 48 | +message NamedCollector { |
| 49 | + string name = 1; |
| 50 | + Collector collector = 2; |
| 51 | +} |
| 52 | + |
| 53 | +message AddRequest { Metric metric = 1; } |
| 54 | +message SubRequest { Metric metric = 1; } |
| 55 | +message ObserveRequest { Metric metric = 1; } |
| 56 | +message SetRequest { Metric metric = 1; } |
| 57 | + |
| 58 | +message DeclareRequest { |
| 59 | + NamedCollector collector = 1; |
| 60 | +} |
| 61 | + |
| 62 | +message UnregisterRequest { |
| 63 | + string name = 1; |
| 64 | +} |
| 65 | + |
| 66 | +message Response { |
| 67 | + bool ok = 1; |
| 68 | +} |
| 69 | + |
| 70 | +// MetricsService exposes runtime metric mutation. All methods are write-side; |
| 71 | +// scraping happens on the separate Prometheus HTTP endpoint configured under |
| 72 | +// `metrics.address` and is not part of this RPC surface. |
| 73 | +service MetricsService { |
| 74 | + rpc Add(AddRequest) returns (Response); |
| 75 | + rpc Sub(SubRequest) returns (Response); |
| 76 | + rpc Observe(ObserveRequest) returns (Response); |
| 77 | + rpc Set(SetRequest) returns (Response); |
| 78 | + rpc Declare(DeclareRequest) returns (Response); |
| 79 | + rpc Unregister(UnregisterRequest) returns (Response); |
| 80 | +} |
0 commit comments