stats

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 0 Imported by: 2 modules, 22 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

Overview

Package stats defines the Stats interface for tracking connection and traffic counters (total connections, current connections, bytes, errors).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind identifies the type of statistic being tracked.

const (
	// KindTotalConns is the total number of connections established.
	KindTotalConns Kind = 1
	// KindCurrentConns is the current number of active connections.
	KindCurrentConns Kind = 2
	// KindInputBytes is the total number of bytes received.
	KindInputBytes Kind = 3
	// KindOutputBytes is the total number of bytes sent.
	KindOutputBytes Kind = 4
	// KindTotalErrs is the total number of errors that occurred.
	KindTotalErrs Kind = 5
)

type Stats

type Stats interface {
	// Add increments the given stat by n.
	Add(kind Kind, n int64)
	// Get returns the current value for the given stat.
	Get(kind Kind) uint64
	// IsUpdated reports whether any stat has changed since the last Reset.
	IsUpdated() bool
	// Reset clears all counters to zero and resets the IsUpdated flag.
	Reset()
}

Stats tracks connection and traffic counters. It is typically attached to listeners and services to monitor runtime activity.

Jump to

Keyboard shortcuts

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