Documentation
¶
Overview ¶
Package metrics provides thread-safe metric primitives for collecting application telemetry data including counters, gauges, and histograms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketSnapshot ¶
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
func NewHistogram ¶
func (*Histogram) Observe ¶
Observe records a new value. Complexity: O(log N) for search + O(1) for atomic write.
func (*Histogram) Snapshot ¶
func (m *Histogram) Snapshot() []BucketSnapshot
Snapshot returns a snapshot of the histogram buckets.
type MetricMap ¶
type MetricMap[T any] struct { // contains filtered or unexported fields }
MetricMap is a concurrent-safe hash-addressed collection of metrics.
It maps a composite label set to a single metric instance using FNV-1a hashing with collision handling. The hash function and storage layout are internal implementation details.
func NewMetricMap ¶
func (*MetricMap[T]) GetOrCreate ¶
GetOrCreate returns the metric for the given label list, creating it via create if it does not yet exist.