diff --git a/go.mod b/go.mod index d9ab55bdf521..11f790219ddd 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/klauspost/pgzip v1.2.6 github.com/minio/minio-go/v7 v7.0.66 github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.18.0 + github.com/prometheus/client_golang v1.19.0 github.com/prometheus/client_model v0.6.0 github.com/prometheus/common v0.48.0 github.com/robfig/cron/v3 v3.0.1 diff --git a/go.sum b/go.sum index 214d45a0ac41..90f9c625fcb6 100644 --- a/go.sum +++ b/go.sum @@ -862,8 +862,8 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= +github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= diff --git a/workflow/controller/operator_metrics_test.go b/workflow/controller/operator_metrics_test.go index 5b5d4dedd8d4..13900a0c822f 100644 --- a/workflow/controller/operator_metrics_test.go +++ b/workflow/controller/operator_metrics_test.go @@ -3,6 +3,7 @@ package controller import ( "context" "fmt" + "regexp" "testing" "time" @@ -15,6 +16,8 @@ import ( "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1" ) +var space = regexp.MustCompile(`\s+`) + var basicMetric = ` apiVersion: argoproj.io/v1alpha1 kind: Workflow @@ -237,7 +240,10 @@ func getMetricStringValue(metric prometheus.Metric) (string, error) { if err != nil { return "", err } - return fmt.Sprintf("%v", metricString.String()), nil + + // Workaround for https://github.com/prometheus/client_model/issues/83 + normalizedString := space.ReplaceAllString(metricString.String(), " ") + return normalizedString, nil } func getMetricGaugeValue(metric prometheus.Metric) (*float64, error) {