tracing

package
v0.0.0-...-9f72101 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SpanBufferSize = 1000

Variables

This section is empty.

Functions

func SetDefaultTracer

func SetDefaultTracer(t *Tracer)

Types

type Span

type Span struct {
	// contains filtered or unexported fields
}

func RootFromContext

func RootFromContext(ctx context.Context) (Span, bool)

func SpanFromContext

func SpanFromContext(ctx context.Context) (Span, bool)

func StartSpan

func StartSpan(ctx context.Context, name string, opts ...SpanOption) (Span, context.Context)

func (*Span) Close

func (s *Span) Close()

func (*Span) CloseWithError

func (s *Span) CloseWithError(err error)

func (*Span) CloseWithOutput

func (s *Span) CloseWithOutput(output any)

func (*Span) MergeAttributes

func (s *Span) MergeAttributes(md map[string]any)

func (*Span) SetAttribute

func (s *Span) SetAttribute(key string, value any)

func (*Span) SetContext

func (s *Span) SetContext(key string, value any)

func (*Span) SetError

func (s *Span) SetError(err error)

func (*Span) SetExpected

func (s *Span) SetExpected(expected any)

func (*Span) SetMetric

func (s *Span) SetMetric(key string, value float64)

func (*Span) SetOutput

func (s *Span) SetOutput(output any)

func (*Span) SetTag

func (s *Span) SetTag(tag ...string)

type SpanOption

type SpanOption func(*Span)

func Attr

func Attr(key string, value any) SpanOption

func Attrs

func Attrs(md map[string]any) SpanOption

func Context

func Context(key string, value any) SpanOption

func Input

func Input(input any) SpanOption

func Kind

func Kind(t SpanType) SpanOption

func Metric

func Metric(key string, value float64) SpanOption

func Tag

func Tag(tag ...string) SpanOption

type SpanType

type SpanType string
const (
	SpanLLM      SpanType = "llm"
	SpanScore    SpanType = "score"
	SpanFunction SpanType = "function"
	SpanEval     SpanType = "eval"
	SpanTask     SpanType = "task"
	SpanTool     SpanType = "tool"
)

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

func DefaultTracer

func DefaultTracer() *Tracer

func NewTracer

func NewTracer(cli braintrust.Client, project string, opts ...SpanOption) *Tracer

func (*Tracer) Close

func (t *Tracer) Close()

func (*Tracer) StartSpan

func (t *Tracer) StartSpan(ctx context.Context, name string, opts ...SpanOption) (Span, context.Context)

Jump to

Keyboard shortcuts

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