Documentation
¶
Overview ¶
Package telemetrytest records what herald's telemetry emits, for tests: a span recorder installed as the global tracer provider, and a go-utils metrics sink that remembers every series registered on it.
Index ¶
- func Attrs(s sdktrace.ReadOnlySpan) map[string]string
- func ExceptionTypes(s sdktrace.ReadOnlySpan) []string
- func Leaks(rec *tracetest.SpanRecorder, value string) []string
- func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
- func One(t *testing.T, rec *tracetest.SpanRecorder, name string) sdktrace.ReadOnlySpan
- func Spans(t *testing.T) *tracetest.SpanRecorder
- type Series
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attrs ¶
func Attrs(s sdktrace.ReadOnlySpan) map[string]string
Attrs returns s's attributes as strings keyed by attribute name.
func ExceptionTypes ¶
func ExceptionTypes(s sdktrace.ReadOnlySpan) []string
ExceptionTypes returns the exception.type of every exception event on s.
func Leaks ¶
func Leaks(rec *tracetest.SpanRecorder, value string) []string
Leaks returns every place value appears in what the recorder saw: a span name, an attribute, an event name or attribute, or a status description. A test that feeds personal data or a secret through the code asserts this is empty.
func Named ¶
func Named(rec *tracetest.SpanRecorder, name string) []sdktrace.ReadOnlySpan
Named returns the ended spans called name, in the order they ended.
func One ¶
func One(t *testing.T, rec *tracetest.SpanRecorder, name string) sdktrace.ReadOnlySpan
One returns the only ended span called name, failing the test otherwise.
Types ¶
type Series ¶
type Series struct {
Name string
Kind string // counter or histogram
Labels map[string]string
Unit string
Buckets []float64
// contains filtered or unexported fields
}
Series is one metric series registered on a Sink.
type Sink ¶
type Sink struct {
*gometrics.MockMetrics
// contains filtered or unexported fields
}
Sink is a go-utils metrics.Metrics that remembers every counter and histogram registered on it, keyed by name and labels.