tracing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAttribute

func AddAttribute(ctx context.Context, key string, value interface{})

AddAttribute adds a single attribute to the current span

func AddAttributes

func AddAttributes(ctx context.Context, attrs ...attribute.KeyValue)

AddAttributes adds multiple attributes to the current span

func CreateEvent

func CreateEvent(ctx context.Context, name string, attrs ...attribute.KeyValue)

CreateEvent creates an event in the current span

func End

func End(ctx context.Context)

End ends the current span

func RecordError

func RecordError(ctx context.Context, err error, message string)

RecordError records an error in the current span

func SetupTracing

func SetupTracing(serviceName string, otlpEndpoint string) (func(), error)

SetupTracing initializes OpenTelemetry tracing

func StartChildSpan

func StartChildSpan(ctx context.Context, spanName string) (context.Context, otelTrace.Span)

StartChildSpan starts a child span from the current span

func StartSpan

func StartSpan(ctx context.Context, spanName string) (context.Context, otelTrace.Span)

StartSpan starts a new span

Types

type TracedModelInference

type TracedModelInference struct {
	Ctx         context.Context
	ModelName   string
	ParentSpan  trace.Span
	CurrentSpan trace.Span
	StartTime   time.Time
}

TracedModelInference creates spans for model inference operations

func NewTracedModelInference

func NewTracedModelInference(ctx context.Context, modelName string) *TracedModelInference

NewTracedModelInference creates a new traced model inference

func (*TracedModelInference) End

func (t *TracedModelInference) End(outputTokens int, err error)

End ends the parent span and records completion metrics

func (*TracedModelInference) EndProcessing

func (t *TracedModelInference) EndProcessing()

EndProcessing ends the current processing phase span

func (*TracedModelInference) RecordFirstToken

func (t *TracedModelInference) RecordFirstToken(ttft time.Duration)

RecordFirstToken records when the first token is received

func (*TracedModelInference) RecordTokenCounts

func (t *TracedModelInference) RecordTokenCounts(inputTokens, outputTokens int)

RecordTokenCounts records the input and output token counts

func (*TracedModelInference) StartProcessing

func (t *TracedModelInference) StartProcessing(name string)

StartProcessing starts a processing phase span

Jump to

Keyboard shortcuts

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