{"record":{"id":"c75e1a1c8ad39028","repo":"argoproj/argo-workflows","slug":"missing-gauge-value","errorCode":null,"errorMessage":"missing gauge.value","messagePattern":"missing gauge\\.value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/metrics/util.go","lineNumber":26,"sourceCode":"\t\"github.com/prometheus/common/model\"\n\n\twfv1 \"github.com/argoproj/argo-workflows/v4/pkg/apis/workflow/v1alpha1\"\n)\n\nvar (\n\tinvalidMetricNameError  = \"metric name is invalid: names may only contain alphanumeric characters or '_'\"\n\tinvalidMetricLabelError = \"metric label '%s' is invalid: keys may only contain alphanumeric characters or '_'\"\n)\n\nfunc IsValidMetricName(name string) bool {\n\t// Use promtheus's metric name checker, despite perhaps not using prometheus\n\treturn model.LegacyValidation.IsValidMetricName(string(model.LabelValue(name))) && !strings.Contains(name, `:`)\n}\n\nfunc ValidateMetricValues(metric *wfv1.Prometheus) error {\n\tif metric.Gauge != nil {\n\t\tif metric.Gauge.Value == \"\" {\n\t\t\treturn errors.New(\"missing gauge.value\")\n\t\t}\n\t\tif metric.Gauge.Realtime != nil && *metric.Gauge.Realtime {\n\t\t\tif strings.Contains(metric.Gauge.Value, \"resourcesDuration.\") {\n\t\t\t\treturn errors.New(\"'resourcesDuration.*' metrics cannot be used in real-time\")\n\t\t\t}\n\t\t}\n\t}\n\tif metric.Counter != nil && metric.Counter.Value == \"\" {\n\t\treturn errors.New(\"missing counter.value\")\n\t}\n\tif metric.Histogram != nil && metric.Histogram.Value == \"\" {\n\t\treturn errors.New(\"missing histogram.value\")\n\t}\n\treturn nil\n}\n\nfunc ValidateMetricLabels(metrics map[string]string) error {\n\tfor name := range metrics {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/metrics/util.go#L8-L44","documentation":"Template validation guard: a Prometheus metric declared with metric.Gauge set has an empty gauge.value expression, so there is nothing to evaluate. Raised from validateTemplate when a template's metrics block is malformed.","triggerScenarios":"Thrown at workflow/metrics/util.go:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set gauge.value to an expression, e.g. gauge: value: '{{workflow.duration}}'","Remove the gauge block if no gauge metric is intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}