Documentation
¶
Overview ¶
Package telemetrytest records what vault's telemetry emits so tests can assert on it: spans through a tracetest.SpanRecorder installed as the global tracer provider, and metrics through a go-utils sink that remembers every series it handed out.
Index ¶
- func AssertNoLeak(t testing.TB, rec *tracetest.SpanRecorder, needles ...string)
- func Attr(s sdktrace.ReadOnlySpan, key string) (string, bool)
- func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
- func SeriesKey(name string, labels map[string]string) string
- func Spans(t testing.TB) *tracetest.SpanRecorder
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoLeak ¶
func AssertNoLeak(t testing.TB, rec *tracetest.SpanRecorder, needles ...string)
AssertNoLeak fails the test if any needle appears anywhere on an ended span: its name, an attribute, an event or event attribute, its status description, or a link's attributes.
func Attr ¶
func Attr(s sdktrace.ReadOnlySpan, key string) (string, bool)
Attr returns the value of the attribute key on s as a string, and whether s has it.
func Named ¶
func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
Named returns the ended spans called name, in the order they ended.
Types ¶
type Sink ¶
type Sink struct {
*gometrics.MockMetrics
// contains filtered or unexported fields
}
Sink is a go-utils metrics sink that keeps every counter and histogram it hands out, keyed by name and labels.
func (*Sink) AssertNoLeak ¶
AssertNoLeak fails the test if any needle appears in a metric name, label key or label value the sink handed out.