telemetrytest

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package telemetrytest records bastion's spans and scrapes its metrics in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attr

Attr returns the value of key on s and whether s has it.

func Await

func Await(t testing.TB, rec *tracetest.SpanRecorder, name string, n int) []sdktrace.ReadOnlySpan

Await waits until n spans called name have ended, for spans that end on a goroutine of their own, and returns them. It fails t after five seconds.

func MetricsApp

func MetricsApp(t testing.TB) forge.App

MetricsApp returns a Forge app to record metrics into and scrape. forge.New installs its own tracer provider and propagator as the globals; MetricsApp puts the previous ones back, so a Recorder installed before it keeps recording.

func Named

Named returns the ended spans called name.

func NeverRecorded

func NeverRecorded(t testing.TB, rec *tracetest.SpanRecorder, value string)

NeverRecorded fails t if value shows up anywhere on the spans rec ended: a name, an attribute key or value, an event or its attributes, a link's attributes or a status description.

func One

One returns the only ended span called name, failing t unless there is exactly one.

func Recorder

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

Recorder installs a tracer provider that records every span, and the W3C trace context propagator, as the OTel globals. The previous ones come back when the test ends.

func Scrape

func Scrape(t testing.TB, app forge.App) string

Scrape returns the Prometheus exposition of app's metrics.

func Series

func Series(body, name string) []string

Series returns the scrape lines for the metric called name (its sample lines, not HELP or TYPE).

Types

This section is empty.

Jump to

Keyboard shortcuts

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