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 f7e5c6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 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
26 changes: 11 additions & 15 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 @@ -125,18 +125,18 @@ var (
)

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)

// Register the metrics with a delay because
// v1.AdditionalCheckMetricLabels is nil during init.
go func() {
time.Sleep(time.Second)

slices.Sort(v1.AdditionalCheckMetricLabels)
setupMetrics()
}()
}

func RemoveCheck(checks v1.Canary) {
Expand Down Expand Up @@ -172,11 +172,7 @@ func GetMetrics(key string) (uptime types.Uptime, latency types.Latency) {
return
}

func Record(
ctx context.Context,
canary v1.Canary,
result *pkg.CheckResult,
) (_uptime types.Uptime, _latency types.Latency) {
func Record(ctx context.Context, canary v1.Canary, result *pkg.CheckResult) (_uptime types.Uptime, _latency types.Latency) {
defer func() {
e := recover()
if e != nil {
Expand Down

0 comments on commit f7e5c6e

Please sign in to comment.