Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetErrorHandler ¶
SetErrorHandler sets a function to be called when an error happens while creating or recording a metric. It returns the previous value.
The default error handler prints the error to stderr.
Types ¶
type Counter ¶
type Counter[N Number] struct { // contains filtered or unexported fields }
A Counter is a cumulative count that is always increasing.
func NewCounter ¶
NewCounter creates and registers a Counter.
The corresponding metric has the given name and description, and is cumulative and summable. If N is time.Duration, the unit will be "ns" (the UCUM name for nanonseconds). If N has a method
Unit() string
then the unit will be the result of calling that method on a zero value of N. Otherwise, the unit will be the empty string.
func (*Counter[N]) Add ¶
func (c *Counter[N]) Add(n N)
Add adds n to the value of the counter. If n is negative, NaN, or infinity, it is not added and the error handler (see SetErrorHandler) is called with an appropriate error.
type Group ¶
type Group[I any, Attrs comparable] struct { // contains filtered or unexported fields }
A Group is a collection of instruments, each with a different value of Attrs. Attrs must be a struct.
func NewCounterGroup ¶
func NewCounterGroup[N Number, A comparable](meter ometric.Meter, name, desc string) Group[*Counter[N], A]
NewCounterGroup creates a group of counters that differ in the values of the type A, which must be a struct. See NewCounter for details about the corresponding metric.
type IgnoreValueError ¶
func (*IgnoreValueError) Error ¶
func (e *IgnoreValueError) Error() string