telemetrytest

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package telemetrytest is a recording metrics sink for cortex's own tests.

The go-utils collector keys series by name alone, so every labelled child of one family would collapse into the first. A Forge app keys them by name and labels, and this sink does the same, which is what lets a root-module test assert label values without importing forge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sink

type Sink struct {
	*gometrics.MockMetrics
	// contains filtered or unexported fields
}

Sink records every series the code under test declares.

func NewSink

func NewSink() *Sink

NewSink returns an empty sink.

func (*Sink) LabelKeys

func (s *Sink) LabelKeys(name string) [][]string

LabelKeys returns the label keys each series of name carries, one sorted key list per series.

func (*Sink) Names

func (s *Sink) Names() []string

Names returns every declared metric name, sorted and without repeats.

func (*Sink) Scrape

func (s *Sink) Scrape() string

Scrape renders every series as one line of name{labels} value, the way an exposition format would, so a test can search it for text that must never become a label.

func (*Sink) Value

func (s *Sink) Value(name string, labels map[string]string) float64

Value returns a counter's or gauge's value, or a histogram's count, for the series with exactly these labels. A series never declared reads 0.

Jump to

Keyboard shortcuts

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