Skip to content

Commit

Permalink
reducing healthcheck metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Mar 9, 2021
1 parent 73b7bcd commit 393494d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions api/health/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import (
"net/http"
"time"

stdjson "encoding/json"

"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/utils/json"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/gorilla/rpc/v2"
"github.com/prometheus/client_golang/prometheus"

stdjson "encoding/json"
health "github.com/AppsFlyer/go-sundheit"
healthlib "github.com/ava-labs/avalanchego/health"
)
Expand Down
8 changes: 4 additions & 4 deletions health/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
package health

import (
health "github.com/AppsFlyer/go-sundheit"
"github.com/prometheus/client_golang/prometheus"

"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/wrappers"
"github.com/prometheus/client_golang/prometheus"

health "github.com/AppsFlyer/go-sundheit"
)

// metrics reports commonly used health check metrics.
Expand Down Expand Up @@ -40,7 +40,7 @@ func newMetrics(log logging.Logger, namespace string, registerer prometheus.Regi

// healthy handles the metrics for the healthy cases
func (m *metrics) healthy(health.Result) {
m.failingChecks.Dec()
m.failingChecks.Set(0)
}

// unHealthy handles the metrics for the unhealthy cases
Expand Down
2 changes: 1 addition & 1 deletion vms/platformvm/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (vm *VM) HealthCheck() (interface{}, error) {
"percentConnected": percentConnected,
}
if percentConnected < constants.MinConnectedStake { // Use alpha from consensus instead of const
return details, fmt.Errorf("not connected to enough stake - connected to %f percent of the stake; should be connected to at least %f",
return details, fmt.Errorf("connected to %f percent of the stake; should be connected to at least %f",
percentConnected,
constants.MinConnectedStake,
)
Expand Down

0 comments on commit 393494d

Please sign in to comment.