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

telemetrytest

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package telemetrytest holds the helpers authsome's telemetry tests share: a real Forge metrics registry with its Prometheus scrape, and a span recorder installed as the global tracer provider. Only tests import it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attrs

func Attrs(s sdktrace.ReadOnlySpan) map[string]string

Attrs returns a span's attributes as strings keyed by attribute name.

func Authsome

Authsome returns the ended spans authsome started, in the order they ended.

func Named

func Named(spans []sdktrace.ReadOnlySpan, name string) []sdktrace.ReadOnlySpan

Named returns the spans called name.

func Names

func Names(spans []sdktrace.ReadOnlySpan) []string

Names returns the names of spans.

func OnlyAuthsome

func OnlyAuthsome(spans []sdktrace.ReadOnlySpan) []sdktrace.ReadOnlySpan

OnlyAuthsome keeps the spans authsome started.

func Registry

func Registry(t testing.TB) (reg gometrics.Metrics, scrape func() string)

Registry returns a Forge app's metrics registry and a func that scrapes it the way /_/metrics does.

forge.New installs its own global tracer provider and propagator. This puts back whatever was there before, so a recorder from Spans keeps receiving spans whichever of the two a test calls first.

func Series

func Series(body, prefix string) []string

Series returns the sample lines in a scrape whose metric name starts with prefix, without their values and without histogram bucket lines.

func Spans

func Spans(t testing.TB) *tracetest.SpanRecorder

Spans makes a SpanRecorder the global tracer provider for the rest of the test and puts the previous provider back afterwards. Tests that use it must not run in parallel.

func Text

Text flattens everything a span carries that an exporter would ship (name, attributes, events and their attributes, status, links) into one string, for tests that assert a value appears nowhere on it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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