Expose metric names and their labels and selectors for SLIs
The first part of gitlab-com/gl-infra/scalability#2602 (closed) to achieve unified recording rule registry.
This MR implements a new sliMetricsDescriptor
object with the following methods:
-
metricNamesAndAggregationLabels()
returns a hash of{ metric: set(labels) }
-
metricNamesAndSelectors()
returns a hash of{ metric: { label: { oneOf: [value] } } }
.- The selectors for the same metric are being merged together so the resulting selector is in the form of
{ label: { oneOf: [v1, v2, v3,...] } }
. See the tests inlibsonnet/servicemetrics/service_level_indicator_helper_test.jsonnet
for the examples.
- The selectors for the same metric are being merged together so the resulting selector is in the form of
The metrics and labels will be used to generate the sli_aggregations
recording rules (first layer of aggregation from source metrics) for that service (in !6711 (merged)).
Edited by Gregorius Marco