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