Skip to content

Commit

Permalink
chore: remove redundant methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Jan 23, 2024
1 parent 0a56349 commit 167237c
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions p2p/exchange_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ func newExchangeMetrics() (m *exchangeMetrics, err error) {
return m, nil
}

func (m *exchangeMetrics) observeMetrics(ctx context.Context, obs metric.Observer) error {
_ = m.observeTrackedPeers(ctx, obs)
_ = m.observeDisconnectedPeers(ctx, obs)
_ = m.observeBlockedPeers(ctx, obs)
func (m *exchangeMetrics) observeMetrics(_ context.Context, obs metric.Observer) error {
obs.ObserveInt64(m.trackedPeersNumInst, m.trackerPeersNum.Load())
obs.ObserveInt64(m.disconnectedPeersNumInst, m.disconnectedPeersNum.Load())
obs.ObserveInt64(m.blockedPeersNumInst, m.blockedPeersNum.Load())
return nil
}

Expand Down Expand Up @@ -150,21 +150,6 @@ func (m *exchangeMetrics) peerBlocked() {
})
}

func (m *exchangeMetrics) observeTrackedPeers(_ context.Context, obs metric.Observer) error {
obs.ObserveInt64(m.trackedPeersNumInst, m.trackerPeersNum.Load())
return nil
}

func (m *exchangeMetrics) observeDisconnectedPeers(_ context.Context, obs metric.Observer) error {
obs.ObserveInt64(m.disconnectedPeersNumInst, m.disconnectedPeersNum.Load())
return nil
}

func (m *exchangeMetrics) observeBlockedPeers(_ context.Context, obs metric.Observer) error {
obs.ObserveInt64(m.blockedPeersNumInst, m.blockedPeersNum.Load())
return nil
}

func (m *exchangeMetrics) observe(ctx context.Context, observeFn func(context.Context)) {
if m == nil {
return
Expand Down

0 comments on commit 167237c

Please sign in to comment.