Skip to content

Commit

Permalink
fix NilMeter
Browse files Browse the repository at this point in the history
  • Loading branch information
JukLee0ira committed Jan 19, 2025
1 parent 9649a04 commit fbe5154
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,6 @@ func CollectProcessMetrics(refresh time.Duration) {
time.Sleep(refresh)
}
}

// NilMeter is a no-op Meter.
type NilMeter struct{}
12 changes: 6 additions & 6 deletions p2p/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ var (
)

var (
activePeerGauge metrics.Gauge = metrics.NilGauge{}
activePeerGauge *metrics.Gauge

// general ingress/egress connection meters
serveMeter metrics.Meter = metrics.NilMeter{}
serveSuccessMeter metrics.Meter = metrics.NilMeter{}
dialMeter metrics.Meter = metrics.NilMeter{}
dialSuccessMeter metrics.Meter = metrics.NilMeter{}
dialConnectionError metrics.Meter = metrics.NilMeter{}
serveMeter *metrics.Meter
serveSuccessMeter *metrics.Meter
dialMeter *metrics.Meter
dialSuccessMeter *metrics.Meter
dialConnectionError *metrics.Meter

// handshake error meters
dialTooManyPeers = metrics.NewRegisteredMeter("p2p/dials/error/saturated", nil)
Expand Down

0 comments on commit fbe5154

Please sign in to comment.