Help us shape the future of Go! Take the 2026 Go Developer Survey

tracingtest

package
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package tracingtest captures the spans Genkit reports, in memory and with no OpenTelemetry SDK, for tests across the module. core/tracing's own tests cannot import it (import cycle) and keep local helpers.

The instrumentation registry is process-wide, so a test that calls Capture must not run in parallel with other tests that read spans.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attr

func Attr(span *tracing.SpanData, key string) (string, bool)

Attr returns the string value of the span attribute key, if present.

Types

type Recorder

type Recorder struct {
	*tracing.TestOnlyTelemetryClient
}

Recorder is an in-memory capture of the spans Genkit reports.

func Capture

func Capture(t testing.TB) *Recorder

Capture routes spans to a fresh recorder for the rest of the test, then restores the InstallDefault provider (or the implicit default) on cleanup.

func InstallDefault

func InstallDefault() *Recorder

InstallDefault routes every span in the test binary to an in-memory recorder, so runs carry real trace ids without an OpenTelemetry SDK. Call it from TestMain; Capture restores it after each capturing test.

func (*Recorder) ByName

func (r *Recorder) ByName(name string) []*tracing.SpanData

ByName returns every recorded span with the given display name.

func (*Recorder) First

func (r *Recorder) First(name string) *tracing.SpanData

First returns the first recorded span with the given display name, or nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL