Documentation
¶
Overview ¶
Package telemetrytest holds what ledger's tests use to see its telemetry: a span recorder installed as the global tracer provider, and a metrics sink that keeps every series it hands out.
Index ¶
- func AssertNoValue(t *testing.T, rec *tracetest.SpanRecorder, value string)
- func Attr(s sdktrace.ReadOnlySpan, key string) (attribute.Value, bool)
- func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
- func Names(rec *tracetest.SpanRecorder) []string
- func Only(t *testing.T, rec *tracetest.SpanRecorder, name string) sdktrace.ReadOnlySpan
- func RecordSpans(t *testing.T) *tracetest.SpanRecorder
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoValue ¶
func AssertNoValue(t *testing.T, rec *tracetest.SpanRecorder, value string)
AssertNoValue fails the test if value appears anywhere on an ended span: its name, an attribute, an event or its status.
func Named ¶
func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
Named returns the ended spans called name, in the order they ended.
func Names ¶
func Names(rec *tracetest.SpanRecorder) []string
Names lists the names of the ended spans.
func Only ¶
func Only(t *testing.T, rec *tracetest.SpanRecorder, name string) sdktrace.ReadOnlySpan
Only returns the one ended span called name, and fails the test unless there is exactly one.
func RecordSpans ¶
func RecordSpans(t *testing.T) *tracetest.SpanRecorder
RecordSpans installs a span recorder as the global tracer provider until the test ends, then puts the previous provider back.
Types ¶
type Sink ¶
type Sink struct {
*gometrics.MockMetrics
// contains filtered or unexported fields
}
Sink is a go-utils metrics registry that keeps every counter and histogram it hands out, keyed the way Prometheus prints a series: name{key="value",...}, keys sorted.
func (*Sink) AssertOneLabelSet ¶
AssertOneLabelSet fails the test if two series of one metric carry different label keys.
func (*Sink) Observations ¶
Observations returns how many values a histogram series has seen, zero if it was never created.