From c09058c59a2876838927f8d5e175db299d802c66 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Fri, 25 Aug 2023 14:02:59 +0530 Subject: [PATCH] chore: update custom metric label type (#1234) * chore: update custom metric label type * chore: fix lint --- api/external/metrics.go | 24 +- api/external/zz_generated.deepcopy.go | 6 +- checks/metrics.go | 48 +- config/deploy/crd.yaml | 555 ++++++++++++++---- config/deploy/manifests.yaml | 555 ++++++++++++++---- config/schemas/canary.schema.json | 31 +- config/schemas/component.schema.json | 31 +- .../schemas/health_alertmanager.schema.json | 31 +- config/schemas/health_awsconfig.schema.json | 31 +- .../schemas/health_awsconfigrule.schema.json | 31 +- config/schemas/health_azuredevops.schema.json | 31 +- config/schemas/health_cloudwatch.schema.json | 31 +- config/schemas/health_configdb.schema.json | 31 +- .../schemas/health_containerdPull.schema.json | 31 +- .../schemas/health_containerdPush.schema.json | 31 +- .../health_databasebackupcheck.schema.json | 31 +- config/schemas/health_dns.schema.json | 31 +- config/schemas/health_dockerPull.schema.json | 31 +- config/schemas/health_dockerPush.schema.json | 31 +- config/schemas/health_dynatrace.schema.json | 31 +- config/schemas/health_ec2.schema.json | 31 +- .../schemas/health_elasticsearch.schema.json | 31 +- config/schemas/health_exec.schema.json | 31 +- config/schemas/health_folder.schema.json | 31 +- config/schemas/health_github.schema.json | 31 +- config/schemas/health_helm.schema.json | 31 +- config/schemas/health_http.schema.json | 31 +- config/schemas/health_icmp.schema.json | 31 +- config/schemas/health_jmeter.schema.json | 31 +- config/schemas/health_junit.schema.json | 31 +- config/schemas/health_kubernetes.schema.json | 31 +- config/schemas/health_ldap.schema.json | 31 +- config/schemas/health_mongodb.schema.json | 31 +- config/schemas/health_mssql.schema.json | 31 +- config/schemas/health_mysql.schema.json | 31 +- config/schemas/health_namespace.schema.json | 31 +- config/schemas/health_opensearch.schema.json | 31 +- config/schemas/health_pod.schema.json | 31 +- config/schemas/health_postgres.schema.json | 31 +- config/schemas/health_prometheus.schema.json | 31 +- config/schemas/health_redis.schema.json | 31 +- config/schemas/health_restic.schema.json | 31 +- config/schemas/health_s3.schema.json | 31 +- config/schemas/health_tcp.schema.json | 31 +- config/schemas/topology.schema.json | 31 +- fixtures/k8s/junit_pass.yaml | 19 +- fixtures/minimal/http_pass_single.yaml | 9 +- 47 files changed, 1945 insertions(+), 511 deletions(-) diff --git a/api/external/metrics.go b/api/external/metrics.go index fbf897bb0..b954ff831 100644 --- a/api/external/metrics.go +++ b/api/external/metrics.go @@ -2,8 +2,24 @@ package external // +kubebuilder:object:generate=true type Metrics struct { - Name string `json:"name,omitempty" yaml:"name,omitempty"` - Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"` - Type string `json:"type,omitempty" yaml:"type,omitempty"` - Value string `json:"value,omitempty" yaml:"value,omitempty"` + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Labels MetricLabels `json:"labels,omitempty" yaml:"labels,omitempty"` + Type string `json:"type,omitempty" yaml:"type,omitempty"` + Value string `json:"value,omitempty" yaml:"value,omitempty"` +} + +type MetricLabels []MetricLabel + +type MetricLabel struct { + Name string `json:"name"` + Value string `json:"value,omitempty"` + ValueExpr string `json:"valueExpr,omitempty"` +} + +func (labels MetricLabels) Names() []string { + var names []string + for _, k := range labels { + names = append(names, k.Name) + } + return names } diff --git a/api/external/zz_generated.deepcopy.go b/api/external/zz_generated.deepcopy.go index 9c15d4d91..bc950773e 100644 --- a/api/external/zz_generated.deepcopy.go +++ b/api/external/zz_generated.deepcopy.go @@ -28,10 +28,8 @@ func (in *Metrics) DeepCopyInto(out *Metrics) { *out = *in if in.Labels != nil { in, out := &in.Labels, &out.Labels - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } + *out = make(MetricLabels, len(*in)) + copy(*out, *in) } } diff --git a/checks/metrics.go b/checks/metrics.go index c79014502..b320f949e 100644 --- a/checks/metrics.go +++ b/checks/metrics.go @@ -2,7 +2,6 @@ package checks import ( "encoding/json" - "sort" "strconv" "github.com/flanksource/canary-checker/api/context" @@ -14,41 +13,23 @@ import ( var collectorMap = make(map[string]prometheus.Collector) -func promLabelsOrderedKeys(labels map[string]string) []string { - var keys []string - for k := range labels { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} - -func promLabelsOrderedVals(labels map[string]string) []string { - var vals []string - keys := promLabelsOrderedKeys(labels) - for _, k := range keys { - vals = append(vals, labels[k]) - } - return vals -} - -func addPrometheusMetric(name, metricType string, labels map[string]string) prometheus.Collector { +func addPrometheusMetric(name, metricType string, labelNames []string) prometheus.Collector { var collector prometheus.Collector switch metricType { case "histogram": collector = prometheus.NewHistogramVec( prometheus.HistogramOpts{Name: name}, - promLabelsOrderedKeys(labels), + labelNames, ) case "counter": collector = prometheus.NewCounterVec( prometheus.CounterOpts{Name: name}, - promLabelsOrderedKeys(labels), + labelNames, ) case "gauge": collector = prometheus.NewGaugeVec( prometheus.GaugeOpts{Name: name}, - promLabelsOrderedKeys(labels), + labelNames, ) default: return nil @@ -73,7 +54,7 @@ func exportCheckMetrics(ctx *context.Context, results pkg.Results) { var collector prometheus.Collector var exists bool if collector, exists = collectorMap[spec.Name]; !exists { - collector = addPrometheusMetric(spec.Name, spec.Type, spec.Labels) + collector = addPrometheusMetric(spec.Name, spec.Type, spec.Labels.Names()) if collector == nil { logger.Errorf("Invalid type for check.metrics %s for check[%s]", spec.Type, r.Check.GetName()) continue @@ -114,16 +95,19 @@ func exportCheckMetrics(ctx *context.Context, results pkg.Results) { logger.Errorf("Error converting value %s to float for check.metrics template %s for check[%s]: %v", valRaw, spec.Value, r.Check.GetName(), err) continue } - tplLabels := make(map[string]string) - for labelKey, labelVal := range spec.Labels { - label, err := template(ctx.New(templateInput), v1.Template{Expression: labelVal}) - if err != nil { - logger.Errorf("Error templating label %s:%s for check.metrics for check[%s]: %v", labelKey, labelVal, r.Check.GetName(), err) - continue + + var orderedLabelVals []string + for _, label := range spec.Labels { + val := label.Value + if label.ValueExpr != "" { + var err error + val, err = template(ctx.New(templateInput), v1.Template{Expression: label.ValueExpr}) + if err != nil { + logger.Errorf("Error templating label %s:%s for check.metrics for check[%s]: %v", label.Name, label.ValueExpr, r.Check.GetName(), err) + } } - tplLabels[labelKey] = label + orderedLabelVals = append(orderedLabelVals, val) } - orderedLabelVals := promLabelsOrderedVals(tplLabels) switch collector := collector.(type) { case *prometheus.HistogramVec: diff --git a/config/deploy/crd.yaml b/config/deploy/crd.yaml index fe463610a..aeea2bf6f 100644 --- a/config/deploy/crd.yaml +++ b/config/deploy/crd.yaml @@ -106,9 +106,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -273,9 +282,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -459,9 +477,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -610,9 +637,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -772,9 +808,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -914,9 +959,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1045,9 +1099,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1088,9 +1151,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1192,9 +1264,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1258,9 +1339,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1378,9 +1468,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1480,9 +1579,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1564,9 +1672,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1677,9 +1794,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1808,9 +1934,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2202,9 +2337,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2443,9 +2587,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2699,9 +2852,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2828,9 +2990,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2927,9 +3098,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3084,9 +3264,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3170,9 +3359,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3239,9 +3437,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3329,9 +3536,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3417,9 +3633,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3524,9 +3749,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3637,9 +3871,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3777,9 +4020,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3929,9 +4181,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4011,9 +4272,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4168,9 +4438,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4239,9 +4518,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4382,9 +4670,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4515,9 +4812,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4658,9 +4964,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4799,9 +5114,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4913,9 +5237,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml index 6d208ec2d..09550dacc 100644 --- a/config/deploy/manifests.yaml +++ b/config/deploy/manifests.yaml @@ -106,9 +106,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -273,9 +282,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -459,9 +477,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -610,9 +637,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -772,9 +808,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -914,9 +959,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1045,9 +1099,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1088,9 +1151,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1192,9 +1264,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1258,9 +1339,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1378,9 +1468,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1480,9 +1579,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1564,9 +1672,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1677,9 +1794,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -1808,9 +1934,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2202,9 +2337,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2443,9 +2587,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2699,9 +2852,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2828,9 +2990,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -2927,9 +3098,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3084,9 +3264,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3170,9 +3359,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3239,9 +3437,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3329,9 +3536,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3417,9 +3633,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3524,9 +3749,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3637,9 +3871,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3777,9 +4020,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -3929,9 +4181,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4011,9 +4272,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4168,9 +4438,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4239,9 +4518,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4382,9 +4670,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4515,9 +4812,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4658,9 +4964,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4799,9 +5114,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: @@ -4913,9 +5237,18 @@ spec: items: properties: labels: - additionalProperties: - type: string - type: object + items: + properties: + name: + type: string + value: + type: string + valueExpr: + type: string + required: + - name + type: object + type: array name: type: string type: diff --git a/config/schemas/canary.schema.json b/config/schemas/canary.schema.json index fedc35b3e..e6c19d84e 100644 --- a/config/schemas/canary.schema.json +++ b/config/schemas/canary.schema.json @@ -2062,18 +2062,37 @@ "additionalProperties": false, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/component.schema.json b/config/schemas/component.schema.json index 423f70148..030db15e6 100644 --- a/config/schemas/component.schema.json +++ b/config/schemas/component.schema.json @@ -2324,18 +2324,37 @@ "additionalProperties": false, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_alertmanager.schema.json b/config/schemas/health_alertmanager.schema.json index 8fd02459a..127aadaee 100644 --- a/config/schemas/health_alertmanager.schema.json +++ b/config/schemas/health_alertmanager.schema.json @@ -132,18 +132,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_awsconfig.schema.json b/config/schemas/health_awsconfig.schema.json index 5dc0b5e9c..5ab9e04cc 100644 --- a/config/schemas/health_awsconfig.schema.json +++ b/config/schemas/health_awsconfig.schema.json @@ -126,18 +126,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_awsconfigrule.schema.json b/config/schemas/health_awsconfigrule.schema.json index 990814a46..8c107cc24 100644 --- a/config/schemas/health_awsconfigrule.schema.json +++ b/config/schemas/health_awsconfigrule.schema.json @@ -137,18 +137,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_azuredevops.schema.json b/config/schemas/health_azuredevops.schema.json index 3fcfe6e29..5e7ed31f8 100644 --- a/config/schemas/health_azuredevops.schema.json +++ b/config/schemas/health_azuredevops.schema.json @@ -131,18 +131,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_cloudwatch.schema.json b/config/schemas/health_cloudwatch.schema.json index 62f13dd56..3549b9ab9 100644 --- a/config/schemas/health_cloudwatch.schema.json +++ b/config/schemas/health_cloudwatch.schema.json @@ -134,18 +134,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_configdb.schema.json b/config/schemas/health_configdb.schema.json index eaf9cf83c..282096879 100644 --- a/config/schemas/health_configdb.schema.json +++ b/config/schemas/health_configdb.schema.json @@ -54,18 +54,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_containerdPull.schema.json b/config/schemas/health_containerdPull.schema.json index a41a7ed53..ab4e61298 100644 --- a/config/schemas/health_containerdPull.schema.json +++ b/config/schemas/health_containerdPull.schema.json @@ -108,18 +108,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_containerdPush.schema.json b/config/schemas/health_containerdPush.schema.json index 570bacf3b..43418aca5 100644 --- a/config/schemas/health_containerdPush.schema.json +++ b/config/schemas/health_containerdPush.schema.json @@ -51,18 +51,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_databasebackupcheck.schema.json b/config/schemas/health_databasebackupcheck.schema.json index 274e53798..9e8e1b985 100644 --- a/config/schemas/health_databasebackupcheck.schema.json +++ b/config/schemas/health_databasebackupcheck.schema.json @@ -132,18 +132,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_dns.schema.json b/config/schemas/health_dns.schema.json index d983be8c8..b79b422f9 100644 --- a/config/schemas/health_dns.schema.json +++ b/config/schemas/health_dns.schema.json @@ -68,18 +68,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_dockerPull.schema.json b/config/schemas/health_dockerPull.schema.json index 0e6d06251..e6261b25d 100644 --- a/config/schemas/health_dockerPull.schema.json +++ b/config/schemas/health_dockerPull.schema.json @@ -108,18 +108,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_dockerPush.schema.json b/config/schemas/health_dockerPush.schema.json index 8f4cec1a9..553a71495 100644 --- a/config/schemas/health_dockerPush.schema.json +++ b/config/schemas/health_dockerPush.schema.json @@ -102,18 +102,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_dynatrace.schema.json b/config/schemas/health_dynatrace.schema.json index 4ba4dd22d..56f45fe10 100644 --- a/config/schemas/health_dynatrace.schema.json +++ b/config/schemas/health_dynatrace.schema.json @@ -107,18 +107,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_ec2.schema.json b/config/schemas/health_ec2.schema.json index 5c05edc74..f998e01cc 100644 --- a/config/schemas/health_ec2.schema.json +++ b/config/schemas/health_ec2.schema.json @@ -143,18 +143,37 @@ "additionalProperties": false, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_elasticsearch.schema.json b/config/schemas/health_elasticsearch.schema.json index 6519b053d..98978f847 100644 --- a/config/schemas/health_elasticsearch.schema.json +++ b/config/schemas/health_elasticsearch.schema.json @@ -113,18 +113,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_exec.schema.json b/config/schemas/health_exec.schema.json index 7cbba417c..afe65cfc6 100644 --- a/config/schemas/health_exec.schema.json +++ b/config/schemas/health_exec.schema.json @@ -180,18 +180,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_folder.schema.json b/config/schemas/health_folder.schema.json index d362f55ad..a308eacaa 100644 --- a/config/schemas/health_folder.schema.json +++ b/config/schemas/health_folder.schema.json @@ -204,18 +204,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_github.schema.json b/config/schemas/health_github.schema.json index 494a482f9..8240d25e8 100644 --- a/config/schemas/health_github.schema.json +++ b/config/schemas/health_github.schema.json @@ -102,18 +102,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_helm.schema.json b/config/schemas/health_helm.schema.json index 73539c028..8f31568a9 100644 --- a/config/schemas/health_helm.schema.json +++ b/config/schemas/health_helm.schema.json @@ -107,18 +107,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_http.schema.json b/config/schemas/health_http.schema.json index 65df542cc..10aec39b1 100644 --- a/config/schemas/health_http.schema.json +++ b/config/schemas/health_http.schema.json @@ -165,18 +165,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_icmp.schema.json b/config/schemas/health_icmp.schema.json index 10ac95b6c..b0229a5d1 100644 --- a/config/schemas/health_icmp.schema.json +++ b/config/schemas/health_icmp.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_jmeter.schema.json b/config/schemas/health_jmeter.schema.json index 856b565af..6a7ee609f 100644 --- a/config/schemas/health_jmeter.schema.json +++ b/config/schemas/health_jmeter.schema.json @@ -108,18 +108,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_junit.schema.json b/config/schemas/health_junit.schema.json index 08e500774..9f17b122d 100644 --- a/config/schemas/health_junit.schema.json +++ b/config/schemas/health_junit.schema.json @@ -59,18 +59,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_kubernetes.schema.json b/config/schemas/health_kubernetes.schema.json index 26a513029..83bffb372 100644 --- a/config/schemas/health_kubernetes.schema.json +++ b/config/schemas/health_kubernetes.schema.json @@ -69,18 +69,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_ldap.schema.json b/config/schemas/health_ldap.schema.json index abbe81d9a..ec4a297b8 100644 --- a/config/schemas/health_ldap.schema.json +++ b/config/schemas/health_ldap.schema.json @@ -105,18 +105,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_mongodb.schema.json b/config/schemas/health_mongodb.schema.json index c76561e4d..bfbbcbdaf 100644 --- a/config/schemas/health_mongodb.schema.json +++ b/config/schemas/health_mongodb.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_mssql.schema.json b/config/schemas/health_mssql.schema.json index 3ab31fd3b..7ed436154 100644 --- a/config/schemas/health_mssql.schema.json +++ b/config/schemas/health_mssql.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_mysql.schema.json b/config/schemas/health_mysql.schema.json index 39cc8e918..fbebb1556 100644 --- a/config/schemas/health_mysql.schema.json +++ b/config/schemas/health_mysql.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_namespace.schema.json b/config/schemas/health_namespace.schema.json index d413142cd..d9cd0980c 100644 --- a/config/schemas/health_namespace.schema.json +++ b/config/schemas/health_namespace.schema.json @@ -11,18 +11,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_opensearch.schema.json b/config/schemas/health_opensearch.schema.json index f95a7e965..d64262f46 100644 --- a/config/schemas/health_opensearch.schema.json +++ b/config/schemas/health_opensearch.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_pod.schema.json b/config/schemas/health_pod.schema.json index 725a3ae40..9164c4929 100644 --- a/config/schemas/health_pod.schema.json +++ b/config/schemas/health_pod.schema.json @@ -11,18 +11,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_postgres.schema.json b/config/schemas/health_postgres.schema.json index a6553308e..4d2788a4f 100644 --- a/config/schemas/health_postgres.schema.json +++ b/config/schemas/health_postgres.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_prometheus.schema.json b/config/schemas/health_prometheus.schema.json index 3af9bfd86..1ccc7e70c 100644 --- a/config/schemas/health_prometheus.schema.json +++ b/config/schemas/health_prometheus.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_redis.schema.json b/config/schemas/health_redis.schema.json index 1ef257cd9..5001ad5da 100644 --- a/config/schemas/health_redis.schema.json +++ b/config/schemas/health_redis.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_restic.schema.json b/config/schemas/health_restic.schema.json index ecfb4e0a6..5e923cf43 100644 --- a/config/schemas/health_restic.schema.json +++ b/config/schemas/health_restic.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_s3.schema.json b/config/schemas/health_s3.schema.json index d66480df7..b80928304 100644 --- a/config/schemas/health_s3.schema.json +++ b/config/schemas/health_s3.schema.json @@ -53,18 +53,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/health_tcp.schema.json b/config/schemas/health_tcp.schema.json index 12f66f043..ee1bd291a 100644 --- a/config/schemas/health_tcp.schema.json +++ b/config/schemas/health_tcp.schema.json @@ -11,18 +11,37 @@ }, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/config/schemas/topology.schema.json b/config/schemas/topology.schema.json index 89135a8d6..5ad8096ae 100644 --- a/config/schemas/topology.schema.json +++ b/config/schemas/topology.schema.json @@ -2294,18 +2294,37 @@ "additionalProperties": false, "type": "object" }, + "MetricLabel": { + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "valueExpr": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object", + "required": [ + "name" + ] + }, + "MetricLabels": { + "items": { + "$ref": "#/$defs/MetricLabel" + }, + "type": "array" + }, "Metrics": { "properties": { "name": { "type": "string" }, "labels": { - "patternProperties": { - ".*": { - "type": "string" - } - }, - "type": "object" + "$ref": "#/$defs/MetricLabels" }, "type": { "type": "string" diff --git a/fixtures/k8s/junit_pass.yaml b/fixtures/k8s/junit_pass.yaml index 2ff38aebf..6db950cbb 100644 --- a/fixtures/k8s/junit_pass.yaml +++ b/fixtures/k8s/junit_pass.yaml @@ -27,17 +27,24 @@ spec: type: gauge value: "result.results.passed" labels: - name: '"junit_check_pass_count"' - check_name: "check.name" + - name: name + value: junit_check_pass_count + - name: check_name + valueExpr: check.name - name: junit_check_failed_count type: gauge value: "result.results.failed" labels: - name: '"junit_check_fail_count"' - check_name: "check.name" + - name: name + value: junit_check_fail_count + - name: check_name + valueExpr: check.name - name: junit_check_duration_ms type: histogram value: "check.duration" labels: - name: '"junit_check_duration_ms"' - check_name: "check.name" + - name: name + value: junit_check_duration_ms + - name: check_name + valueExpr: check.name + diff --git a/fixtures/minimal/http_pass_single.yaml b/fixtures/minimal/http_pass_single.yaml index 513b364dd..7ff3d8957 100644 --- a/fixtures/minimal/http_pass_single.yaml +++ b/fixtures/minimal/http_pass_single.yaml @@ -16,9 +16,12 @@ spec: type: counter value: "result.code == 200 ? 1 : 0" labels: - name: '"httpbin_2xx_count"' - check_name: "check.name" - statusClass: "string(result.code).charAt(0)" + - name: name + value: httpbin_2xx_count + - name: check_name + valueExpr: check.name + - name: status_class + valueExpr: string(result.code).charAt(0) - name: http-param-tests url: https://httpbin.demo.aws.flanksource.com/status/200 responseCodes: [201, 200, 301]