statistic

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager collects and manages system statistics.

var DefaultManager *Manager

DefaultManager is the default global statistics manager.

func NewManager

func NewManager() *Manager

NewManager creates a new Manager.

func (*Manager) Drops

func (m *Manager) Drops() int64

Drops returns the total dropped message count (slow subscribers).

func (*Manager) Errors

func (m *Manager) Errors() int64

Errors returns the total error count.

func (*Manager) Memory

func (m *Manager) Memory() uint64

Memory returns the current memory allocation.

func (*Manager) Now

func (m *Manager) Now() (read, publish int64)

Now returns the current read and publish per-second rates.

func (*Manager) PushDrop

func (m *Manager) PushDrop(count int64)

PushDrop increments the drop counter by count.

func (*Manager) PushError

func (m *Manager) PushError()

PushError increments the error counter.

func (*Manager) PushPublish

func (m *Manager) PushPublish(count int64)

PushPublish increments the publish counter.

func (*Manager) PushRead

func (m *Manager) PushRead(count int64)

PushRead increments the read counter.

func (*Manager) ResetStatistic

func (m *Manager) ResetStatistic()

ResetStatistic resets the total counters.

func (*Manager) Snapshot

func (m *Manager) Snapshot() *Snapshot

Snapshot generates a new snapshot struct of current stats.

func (*Manager) Total

func (m *Manager) Total() (read, publish int64)

Total returns the total read and publish counts.

func (*Manager) Uptime

func (m *Manager) Uptime() time.Duration

Uptime returns the duration since the manager started.

type Snapshot

type Snapshot struct {
	ReadTotal     int64         `json:"read_total"`
	PublishTotal  int64         `json:"publish_total"`
	ErrorTotal    int64         `json:"error_total"`
	DropTotal     int64         `json:"drop_total"`
	ReadPerSec    int64         `json:"read_per_sec"`
	PublishPerSec int64         `json:"publish_per_sec"`
	Uptime        time.Duration `json:"uptime"`
	Memory        uint64        `json:"memory"`
}

Snapshot returns a snapshot of current statistics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL