Documentation
¶
Index ¶
- func AddAttribute(ctx context.Context, key string, value interface{})
- func AddAttributes(ctx context.Context, attrs ...attribute.KeyValue)
- func CreateEvent(ctx context.Context, name string, attrs ...attribute.KeyValue)
- func End(ctx context.Context)
- func RecordError(ctx context.Context, err error, message string)
- func SetupTracing(serviceName string, otlpEndpoint string) (func(), error)
- func StartChildSpan(ctx context.Context, spanName string) (context.Context, otelTrace.Span)
- func StartSpan(ctx context.Context, spanName string) (context.Context, otelTrace.Span)
- type TracedModelInference
- func (t *TracedModelInference) End(outputTokens int, err error)
- func (t *TracedModelInference) EndProcessing()
- func (t *TracedModelInference) RecordFirstToken(ttft time.Duration)
- func (t *TracedModelInference) RecordTokenCounts(inputTokens, outputTokens int)
- func (t *TracedModelInference) StartProcessing(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAttribute ¶
AddAttribute adds a single attribute to the current span
func AddAttributes ¶
AddAttributes adds multiple attributes to the current span
func CreateEvent ¶
CreateEvent creates an event in the current span
func RecordError ¶
RecordError records an error in the current span
func SetupTracing ¶
SetupTracing initializes OpenTelemetry tracing
func StartChildSpan ¶
StartChildSpan starts a child span from the current 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