Help us shape the future of Go! Take the 2026 Go Developer Survey

metricstest

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package metricstest is a go-utils metric factory for Dispatch's tests. It keys series by name and labels, as Forge's registry does. go-utils' own collector keys them by name alone, which folds every labelled series into the first one created.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(name string, labels map[string]string) string

Key names one series: its name, then its labels sorted by key.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory records every series created through it.

func New

func New() *Factory

New returns an empty Factory.

func (*Factory) Counter

func (f *Factory) Counter(name string, opts ...gu.MetricOption) gu.Counter

Counter implements gu.MetricFactory.

func (*Factory) CounterValue

func (f *Factory) CounterValue(name string, labels ...string) (float64, bool)

CounterValue returns the value of the counter series name{labels}, and whether it exists. Pass labels as key, value pairs.

func (*Factory) Gauge

func (f *Factory) Gauge(name string, opts ...gu.MetricOption) gu.Gauge

Gauge implements gu.MetricFactory.

func (*Factory) GaugeValue

func (f *Factory) GaugeValue(name string, labels ...string) (float64, bool)

GaugeValue returns the value of the gauge series name{labels}, and whether it exists.

func (*Factory) Histogram

func (f *Factory) Histogram(name string, opts ...gu.MetricOption) gu.Histogram

Histogram implements gu.MetricFactory.

func (*Factory) HistogramCount

func (f *Factory) HistogramCount(name string, labels ...string) (uint64, bool)

HistogramCount returns the observation count of the histogram series name{labels}, and whether it exists.

func (*Factory) Names

func (f *Factory) Names() []string

Names returns every metric name created through f, sorted.

func (*Factory) Series

func (f *Factory) Series(name string) []map[string]string

Series returns the label sets created under name, in creation order.

func (*Factory) Summary

func (f *Factory) Summary(name string, opts ...gu.MetricOption) gu.Summary

Summary implements gu.MetricFactory. Dispatch records no summaries.

func (*Factory) Timer

func (f *Factory) Timer(name string, opts ...gu.MetricOption) gu.Timer

Timer implements gu.MetricFactory. Dispatch records no timers.

Jump to

Keyboard shortcuts

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