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 ¶
- func Attrs(s sdktrace.ReadOnlySpan) map[string]string
- func Authsome(rec *tracetest.SpanRecorder) []sdktrace.ReadOnlySpan
- func Named(spans []sdktrace.ReadOnlySpan, name string) []sdktrace.ReadOnlySpan
- func Names(spans []sdktrace.ReadOnlySpan) []string
- func OnlyAuthsome(spans []sdktrace.ReadOnlySpan) []sdktrace.ReadOnlySpan
- func Registry(t testing.TB) (reg gometrics.Metrics, scrape func() string)
- func Series(body, prefix string) []string
- func Spans(t testing.TB) *tracetest.SpanRecorder
- func Text(s sdktrace.ReadOnlySpan) string
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 ¶
func Authsome(rec *tracetest.SpanRecorder) []sdktrace.ReadOnlySpan
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 OnlyAuthsome ¶
func OnlyAuthsome(spans []sdktrace.ReadOnlySpan) []sdktrace.ReadOnlySpan
OnlyAuthsome keeps the spans authsome started.
func Registry ¶
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 ¶
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 ¶
func Text(s sdktrace.ReadOnlySpan) string
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.