Documentation
¶
Overview ¶
Package telemetrytest records the spans and metrics grove's drivers emit, so a driver test can assert on them without a Forge app.
Index ¶
- func Attr(span sdktrace.ReadOnlySpan, key string) (string, bool)
- func AttrMap(span sdktrace.ReadOnlySpan) map[string]string
- func Ended(rec *tracetest.SpanRecorder) []sdktrace.ReadOnlySpan
- func HasAttr(span sdktrace.ReadOnlySpan, key attribute.Key) bool
- func Parent(ctx context.Context) (context.Context, trace.Span)
- func SQLDB(t testing.TB, fail func(query string) error) *sql.DB
- func Spans(t testing.TB) *tracetest.SpanRecorder
- type Metrics
- type Series
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attr ¶
func Attr(span sdktrace.ReadOnlySpan, key string) (string, bool)
Attr returns the value of key on span as a string, and whether it was set.
func AttrMap ¶
func AttrMap(span sdktrace.ReadOnlySpan) map[string]string
AttrMap returns every attribute on span as strings.
func Ended ¶
func Ended(rec *tracetest.SpanRecorder) []sdktrace.ReadOnlySpan
Ended returns the ended spans the recorder saw from grove's tracer, oldest first, skipping the test's own parent spans.
func HasAttr ¶
func HasAttr(span sdktrace.ReadOnlySpan, key attribute.Key) bool
HasAttr reports whether span carries key at all.
func Parent ¶
Parent starts a span to stand in for the request or job a query runs under. Grove only starts a span when the context already has one.
func SQLDB ¶
SQLDB returns a *sql.DB backed by an in-memory driver, for testing a grove driver's telemetry without a server. fail decides each statement's outcome: return nil for success, or the error the database should report. A query returns one row with one int64 column, unless fail returns sql.ErrNoRows, in which case it returns none.