mirror of
https://github.com/LBRYFoundation/tracker.git
synced 2025-08-23 17:47:29 +00:00
global stats
This commit is contained in:
parent
8f6aaa6527
commit
477f292371
1 changed files with 13 additions and 0 deletions
|
@ -39,6 +39,14 @@ const (
|
||||||
ErroredRequest
|
ErroredRequest
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DefaultStats is a default instance of stats tracking that uses an unbuffered
|
||||||
|
// channel for broadcasting events.
|
||||||
|
var DefaultStats *Stats
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
DefaultStats = New(0)
|
||||||
|
}
|
||||||
|
|
||||||
type PeerStats struct {
|
type PeerStats struct {
|
||||||
// Stats for all peers.
|
// Stats for all peers.
|
||||||
Completed uint64
|
Completed uint64
|
||||||
|
@ -161,3 +169,8 @@ func (s *Stats) handleEvents() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RecordEvent broadcasts an event to the default stats tracking.
|
||||||
|
func RecordEvent(event int) {
|
||||||
|
DefaultStats.RecordEvent(event)
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue