diff --git a/docs/docs/api/platform-api.md b/docs/docs/api/platform-api.md index 55bbc8d8..e622d3d9 100644 --- a/docs/docs/api/platform-api.md +++ b/docs/docs/api/platform-api.md @@ -193,7 +193,8 @@ | Method Name | Request Type | Response Type | Description | | ----------- | ------------ | ------------- | ------------| -| /api.v1.metrics.Service/GetMetrics | [GetMetricsRequest](#api-v1-metrics-GetMetricsRequest) | [GetMetricsResponse](#api-v1-metrics-GetMetricsResponse) | Retrieve metrics. metric_type is mandatory, while the rest of the fields are optional. If project, env or capsule is not specified, they will be treated as wildcards. | +| /api.v1.metrics.Service/GetMetrics | [GetMetricsRequest](#api-v1-metrics-GetMetricsRequest) | [GetMetricsResponse](#api-v1-metrics-GetMetricsResponse) | Retrieve metrics. metric_type is mandatory, while the rest of the fields in the tags are optional. If project, env or capsule is not specified, they will be treated as wildcards. | +| /api.v1.metrics.Service/GetMetricsMany | [GetMetricsManyRequest](#api-v1-metrics-GetMetricsManyRequest) | [GetMetricsManyResponse](#api-v1-metrics-GetMetricsManyResponse) | Retrive metrics for multiple sets of tags at a time. Metrics within the same set of tags will be in ascending order of timestamp. | @@ -8055,34 +8056,50 @@ A docker image tag. - + -### Metadata +### Metric | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| project | [string](#string) | | | -| environment | [string](#string) | | | -| capsule | [string](#string) | | | +| timestamp | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| value | [double](#double) | | | - + -### Metric +### MetricFull | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| timestamp | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| value | [double](#double) | | | -| metadata | [Metadata](#api-v1-metrics-Metadata) | | Metadata is only populated when metrics are aggregated. | +| metric | [Metric](#api-v1-metrics-Metric) | | | +| tags | [Tags](#api-v1-metrics-Tags) | | | + + + + + + + + +### Tags + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| project | [string](#string) | | | +| environment | [string](#string) | | | +| capsule | [string](#string) | | | +| metric_type | [string](#string) | | | @@ -8118,6 +8135,39 @@ A docker image tag. + + +### GetMetricsManyRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| tags | [Tags](#api-v1-metrics-Tags) | repeated | | +| from | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| to | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| aggregation | [Aggregation](#api-v1-metrics-Aggregation) | | | + + + + + + + + +### GetMetricsManyResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| metrics | [MetricFull](#api-v1-metrics-MetricFull) | repeated | | + + + + + + ### GetMetricsRequest @@ -8126,10 +8176,7 @@ A docker image tag. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| metric_type | [string](#string) | | | -| project | [string](#string) | | | -| environment | [string](#string) | | | -| capsule | [string](#string) | | | +| tags | [Tags](#api-v1-metrics-Tags) | | | | from | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | to | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | | aggregation | [Aggregation](#api-v1-metrics-Aggregation) | | | diff --git a/proto/rig/api/v1/metrics/metrics.proto b/proto/rig/api/v1/metrics/metrics.proto index 157fd403..ade6f666 100644 --- a/proto/rig/api/v1/metrics/metrics.proto +++ b/proto/rig/api/v1/metrics/metrics.proto @@ -7,12 +7,16 @@ import "google/protobuf/timestamp.proto"; message Metric { google.protobuf.Timestamp timestamp = 1; double value = 2; - // Metadata is only populated when metrics are aggregated. - Metadata metadata = 4; } -message Metadata { +message MetricFull { + Metric metric = 1; + Tags tags = 2; +} + +message Tags { string project = 1; string environment = 2; string capsule = 3; + string metric_type = 4; } \ No newline at end of file diff --git a/proto/rig/api/v1/metrics/service.proto b/proto/rig/api/v1/metrics/service.proto index 386a1b57..b29e8486 100644 --- a/proto/rig/api/v1/metrics/service.proto +++ b/proto/rig/api/v1/metrics/service.proto @@ -8,25 +8,36 @@ import "api/v1/metrics/metrics.proto"; service Service { // Retrieve metrics. metric_type is mandatory, while the rest of the fields - // are optional. If project, env or capsule is not + // in the tags are optional. If project, env or capsule is not // specified, they will be treated as wildcards. rpc GetMetrics(GetMetricsRequest) returns (GetMetricsResponse) {} + // Retrive metrics for multiple sets of tags at a time. Metrics within the + // same set of tags will be in ascending order of timestamp. + rpc GetMetricsMany(GetMetricsManyRequest) returns (GetMetricsManyResponse) {} } message GetMetricsRequest { - string metric_type = 1; - string project = 2; - string environment = 3; - string capsule = 4; - google.protobuf.Timestamp from = 5; - google.protobuf.Timestamp to = 6; - Aggregation aggregation = 7; + Tags tags = 1; + google.protobuf.Timestamp from = 2; + google.protobuf.Timestamp to = 3; + Aggregation aggregation = 4; } message GetMetricsResponse { repeated Metric metrics = 1; } +message GetMetricsManyRequest { + repeated Tags tags = 1; + google.protobuf.Timestamp from = 2; + google.protobuf.Timestamp to = 3; + Aggregation aggregation = 4; +} + +message GetMetricsManyResponse { + repeated MetricFull metrics = 1; +} + message Aggregation { Aggregator aggregator = 1; google.protobuf.Duration bucket_size = 2;