diff --git a/checks/http.go b/checks/http.go index 1aff0eda7..312b4d933 100644 --- a/checks/http.go +++ b/checks/http.go @@ -164,7 +164,7 @@ func (c *HTTPChecker) Check(ctx *context.Context, extConfig external.Check) pkg. //nolint:staticcheck if check.Endpoint != "" && check.URL != "" { - return results.Failf("cannot specify both endpoint and url") + return results.Invalidf("cannot specify both endpoint and url") } //nolint:staticcheck @@ -174,7 +174,7 @@ func (c *HTTPChecker) Check(ctx *context.Context, extConfig external.Check) pkg. connection, connectionData, err := ctx.GetConnectionTemplate(check.Connection) if err != nil { - return results.Invalidf("error getting connection %v", err) + return results.Failf("error getting connection %v", err) } if connection.URL == "" { diff --git a/pkg/metrics/metrics.go b/pkg/metrics/metrics.go index 05e3bdf85..12267ca67 100644 --- a/pkg/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -94,7 +94,7 @@ func setupMetrics() { checkLabels, ) - prometheus.MustRegister(Gauge, CanaryCheckInfo, OpsCount, OpsSuccessCount, OpsFailedCount, RequestLatency) + prometheus.MustRegister(Gauge, CanaryCheckInfo, OpsCount, OpsSuccessCount, OpsInvalidCount, OpsFailedCount, RequestLatency) } var ( @@ -124,21 +124,6 @@ var ( latencies = cmap.New() ) -func init() { - prometheus.MustRegister( - CanaryCheckInfo, - Gauge, - OpsCount, - OpsFailedCount, - OpsInvalidCount, - OpsSuccessCount, - RequestLatency, - ) - CustomCounters = make(map[string]*prometheus.CounterVec) - CustomGauges = make(map[string]*prometheus.GaugeVec) - CustomHistograms = make(map[string]*prometheus.HistogramVec) -} - func RemoveCheck(checks v1.Canary) { for _, check := range checks.Spec.GetAllChecks() { key := checks.GetKey(check) @@ -284,9 +269,9 @@ func Record( } } else { if result.Invalid { - OpsFailedCount.WithLabelValues(checkMetricLabels...).Inc() - } else { OpsInvalidCount.WithLabelValues(checkMetricLabels...).Inc() + } else { + OpsFailedCount.WithLabelValues(checkMetricLabels...).Inc() } fail.Append(1)