Documentation ¶
Index ¶
- func Counter[N number](id string) counter[N]
- func Gauge[N number](id string) gauge[N]
- func Histogram[N number](id string) histogram[N]
- func Inherit(from, to context.Context, clobber bool) context.Context
- func Initialize(ctx context.Context) (context.Context, error)
- func RegisterCounter(ctx context.Context, id string, unit string, description string) (context.Context, error)
- func RegisterGauge(ctx context.Context, id string, unit string, description string) (context.Context, error)
- func RegisterHistogram(ctx context.Context, id string, unit string, description string) (context.Context, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Counter ¶
func Counter[N number](id string) counter[N]
Counter returns a counter factory for the provided id. If a Counter instance has been registered for that ID, the registered instance will be used. If not, a new instance will get generated.
func Gauge ¶
func Gauge[N number](id string) gauge[N]
Gauge returns a gauge factory for the provided id. If a Gauge instance has been registered for that ID, the registered instance will be used. If not, a new instance will get generated.
func Histogram ¶
func Histogram[N number](id string) histogram[N]
Histogram returns a histogram factory for the provided id. If a Histogram instance has been registered for that ID, the registered instance will be used. If not, a new instance will get generated.
func Inherit ¶
Inherit propagates the ctats client from one context to another. This is particularly useful for taking an initialized context from a main() func and ensuring the ctats is available for request-bound conetxts, such as in a http server pattern.
If the 'to' context already contains an initialized ctats, no change is made. Callers can force a 'from' ctats to override a 'to' ctats by setting clobber=true.
func Initialize ¶
Initialize ensures that a metrics collector exists in the ctx. If the ctx has not already run clues.Initialize() and generated OTEL connection details, an error is returned.
Multiple calls to Initialize will no-op all after the first.
func RegisterCounter ¶
func RegisterCounter( ctx context.Context, id string, unit string, description string, ) (context.Context, error)
RegisterCounter introduces a new counter with the given unit and description. If RegisterCounter is not called before updating a metric value, a counter with no unit or description is created. If RegisterCounter is called for an ID that has already been registered, it no-ops.
func RegisterGauge ¶
func RegisterGauge( ctx context.Context, id string, unit string, description string, ) (context.Context, error)
RegisterGauge introduces a new gauge with the given unit and description. If RegisterGauge is not called before updating a metric value, a gauge with no unit or description is created. If RegisterGauge is called for an ID that has already been registered, it no-ops.
func RegisterHistogram ¶
func RegisterHistogram( ctx context.Context, id string, unit string, description string, ) (context.Context, error)
RegisterHistogram introduces a new histogram with the given unit and description. If RegisterHistogram is not called before updating a metric value, a histogram with no unit or description is created. If RegisterHistogram is called for an ID that has already been registered, it no-ops.
Types ¶
This section is empty.