Skip to content

Commit

Permalink
chore: undo some formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Oct 21, 2024
1 parent 9545569 commit ec6fd04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
4 changes: 2 additions & 2 deletions checks/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 == "" {
Expand Down
21 changes: 3 additions & 18 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec6fd04

Please sign in to comment.