Documentation
¶
Overview ¶
Package telemetrytest records bastion's spans and scrapes its metrics in tests.
Index ¶
- func Attr(s sdktrace.ReadOnlySpan, key string) (attribute.Value, bool)
- func Await(t testing.TB, rec *tracetest.SpanRecorder, name string, n int) []sdktrace.ReadOnlySpan
- func MetricsApp(t testing.TB) forge.App
- func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
- func NeverRecorded(t testing.TB, rec *tracetest.SpanRecorder, value string)
- func One(t testing.TB, rec *tracetest.SpanRecorder, name string) sdktrace.ReadOnlySpan
- func Recorder(t testing.TB) *tracetest.SpanRecorder
- func Scrape(t testing.TB, app forge.App) string
- func Series(body, name string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
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 ¶
func One(t testing.TB, rec *tracetest.SpanRecorder, name string) sdktrace.ReadOnlySpan
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.
Types ¶
This section is empty.