vec

package
v1.12.9 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package vec provides label vectors: a metric declared once with label names, then fetched per label-value tuple. Children are cached so the hot path takes no collector lock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetArityHook

func SetArityHook(f func(name string, want, got int)) (restore func())

SetArityHook replaces what happens on a wrong-arity With call and returns a function that restores the previous hook. Tests use it to fail loudly.

Types

type Vec

type Vec[T any] struct {
	// contains filtered or unexported fields
}

Vec is a metric with declared label names.

func New

func New[T any](name string, labelNames []string, build func(map[string]string) T, sink T) *Vec[T]

New declares a vector. build builds the child for one label set; sink is returned on a wrong-arity call.

func (*Vec[T]) With

func (v *Vec[T]) With(values ...string) T

With returns the child for the given label values, in labelNames order.

Jump to

Keyboard shortcuts

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