Skip to content
Snippets Groups Projects
Unverified Commit 1a6a6997 authored by capossele's avatar capossele
Browse files

:rotating_light: Fix metrics plugin linter warning

parent 7dfd6728
Branches
No related tags found
No related merge requests found
...@@ -44,12 +44,14 @@ var ( ...@@ -44,12 +44,14 @@ var (
}) })
) )
// NeighborDropCount returns the neighbor drop count.
func NeighborDropCount() uint64 { func NeighborDropCount() uint64 {
neighborMutex.RLock() neighborMutex.RLock()
defer neighborMutex.RUnlock() defer neighborMutex.RUnlock()
return neighborDropCount return neighborDropCount
} }
// AvgNeighborConnectionLifeTime return the average neighbor connection lifetime.
func AvgNeighborConnectionLifeTime() float64 { func AvgNeighborConnectionLifeTime() float64 {
neighborMutex.RLock() neighborMutex.RLock()
defer neighborMutex.RUnlock() defer neighborMutex.RUnlock()
...@@ -59,12 +61,14 @@ func AvgNeighborConnectionLifeTime() float64 { ...@@ -59,12 +61,14 @@ func AvgNeighborConnectionLifeTime() float64 {
return float64(neighborConnectionsLifeTime.Milliseconds()) / float64(neighborDropCount) return float64(neighborConnectionsLifeTime.Milliseconds()) / float64(neighborDropCount)
} }
// ConnectionsCount returns the neighbors connections count.
func ConnectionsCount() uint64 { func ConnectionsCount() uint64 {
distanceMutex.RLock() distanceMutex.RLock()
defer distanceMutex.RUnlock() defer distanceMutex.RUnlock()
return connectionsCount return connectionsCount
} }
// AutopeeringDistanceStats returns statistics of the autopeering distance function.
func AutopeeringDistanceStats() (min, max uint64, avg float64) { func AutopeeringDistanceStats() (min, max uint64, avg float64) {
distanceMutex.RLock() distanceMutex.RLock()
defer distanceMutex.RUnlock() defer distanceMutex.RUnlock()
......
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
"go.uber.org/atomic" "go.uber.org/atomic"
) )
// ClientInfo holds info of a client.
type ClientInfo struct { type ClientInfo struct {
OS string OS string
Arch string Arch string
......
...@@ -19,6 +19,7 @@ var ( ...@@ -19,6 +19,7 @@ var (
}) })
) )
// DBSize returns the size of the db.
func DBSize() uint64 { func DBSize() uint64 {
return dbSize.Load() return dbSize.Load()
} }
......
...@@ -19,22 +19,27 @@ var ( ...@@ -19,22 +19,27 @@ var (
analysisOutboundBytes atomic.Uint64 analysisOutboundBytes atomic.Uint64
) )
// FPCInboundBytes returns the total inbound FPC traffic.
func FPCInboundBytes() uint64 { func FPCInboundBytes() uint64 {
return _FPCInboundBytes.Load() return _FPCInboundBytes.Load()
} }
// FPCOutboundBytes returns the total outbound FPC traffic.
func FPCOutboundBytes() uint64 { func FPCOutboundBytes() uint64 {
return _FPCOutboundBytes.Load() return _FPCOutboundBytes.Load()
} }
// GossipInboundBytes returns the total inbound gossip traffic.
func GossipInboundBytes() uint64 { func GossipInboundBytes() uint64 {
return gossipCurrentRx.Load() return gossipCurrentRx.Load()
} }
// GossipOutboundBytes returns the total outbound gossip traffic.
func GossipOutboundBytes() uint64 { func GossipOutboundBytes() uint64 {
return gossipCurrentTx.Load() return gossipCurrentTx.Load()
} }
// AnalysisOutboundBytes returns the total outbound analysis traffic.
func AnalysisOutboundBytes() uint64 { func AnalysisOutboundBytes() uint64 {
return analysisOutboundBytes.Load() return analysisOutboundBytes.Load()
} }
......
...@@ -8,14 +8,24 @@ import ( ...@@ -8,14 +8,24 @@ import (
const ( const (
// should always be 1 second // should always be 1 second
// MPSMeasurementInterval defines the MPS measurement interval
MPSMeasurementInterval = 1 * time.Second MPSMeasurementInterval = 1 * time.Second
// TPSMeasurementInterval defines the TPS measurement interval
TPSMeasurementInterval = 1 * time.Second TPSMeasurementInterval = 1 * time.Second
// can be adjusted as wished // can be adjusted as wished
// MessageTipsMeasurementInterval defines the Communication-layer tips measurement interval
MessageTipsMeasurementInterval = 1 * time.Second MessageTipsMeasurementInterval = 1 * time.Second
ValueTipsMeasurementInterval = 1 * time.Second // ValueTipsMeasurementInterval defines the Value-layer tips measurement interval
CPUUsageMeasurementInterval = 1 * time.Second ValueTipsMeasurementInterval = 1 * time.Second
MemUsageMeasurementInterval = 1 * time.Second // CPUUsageMeasurementInterval defines the CPU usage measurement interval
SyncedMeasurementInterval = 1 * time.Second CPUUsageMeasurementInterval = 1 * time.Second
// MemUsageMeasurementInterval defines the mem usage measurement interval
MemUsageMeasurementInterval = 1 * time.Second
// SyncedMeasurementInterval defines the synced measurement interval
SyncedMeasurementInterval = 1 * time.Second
) )
const ( const (
......
...@@ -14,8 +14,8 @@ var ( ...@@ -14,8 +14,8 @@ var (
memUsageBytes atomic.Uint64 memUsageBytes atomic.Uint64
) )
// CpuUsage returns the current cpu usage // CPUUsage returns the current cpu usage
func CpuUsage() float64 { func CPUUsage() float64 {
return cpuUsage.Load() return cpuUsage.Load()
} }
......
...@@ -27,6 +27,6 @@ func registerProcessMetrics() { ...@@ -27,6 +27,6 @@ func registerProcessMetrics() {
} }
func collectProcesskMetrics() { func collectProcesskMetrics() {
cpuUsage.Set(float64(metrics.CpuUsage())) cpuUsage.Set(float64(metrics.CPUUsage()))
memUsageBytes.Set(float64(metrics.MemUsage())) memUsageBytes.Set(float64(metrics.MemUsage()))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment