Documentation
¶
Overview ¶
Package observe provides observability integration for OmniRetrieve. It supports Phoenix, Opik, and Langfuse through a unified interface.
Index ¶
- func ToContext(ctx context.Context, sc *SpanContext) context.Context
- type NoOpObserver
- func (n *NoOpObserver) OnGraphTraverse(_ context.Context, _ string, _ int, _ int, _ int64)
- func (n *NoOpObserver) OnRerank(_ context.Context, _ string, _ int, _ int, _ int64)
- func (n *NoOpObserver) OnRetrieveEnd(_ context.Context, _ *retrieve.Result, _ error)
- func (n *NoOpObserver) OnRetrieveStart(ctx context.Context, _ retrieve.Query) context.Context
- func (n *NoOpObserver) OnVectorSearch(_ context.Context, _ string, _ int, _ int, _ int64)
- type Observer
- func (o *Observer) OnGraphTraverse(ctx context.Context, backend string, depth int, nodeCount int, latencyMS int64)
- func (o *Observer) OnRerank(ctx context.Context, model string, inputCount int, outputCount int, ...)
- func (o *Observer) OnRetrieveEnd(ctx context.Context, r *retrieve.Result, err error)
- func (o *Observer) OnRetrieveStart(ctx context.Context, q retrieve.Query) context.Context
- func (o *Observer) OnVectorSearch(ctx context.Context, backend string, topK int, resultCount int, ...)
- type ObserverConfig
- type Span
- type SpanContext
- type SpanExporter
- type SpanStatus
- type SpanType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NoOpObserver ¶
type NoOpObserver struct{}
NoOpObserver is a no-op implementation of retrieve.Observer.
func (*NoOpObserver) OnGraphTraverse ¶
OnGraphTraverse implements retrieve.Observer.
func (*NoOpObserver) OnRetrieveEnd ¶
OnRetrieveEnd implements retrieve.Observer.
func (*NoOpObserver) OnRetrieveStart ¶
OnRetrieveStart implements retrieve.Observer.
func (*NoOpObserver) OnVectorSearch ¶
OnVectorSearch implements retrieve.Observer.
type Observer ¶
type Observer struct {
// contains filtered or unexported fields
}
Observer implements retrieve.Observer with full tracing support.
func NewObserver ¶
func NewObserver(cfg ObserverConfig) *Observer
NewObserver creates a new Observer.
func (*Observer) OnGraphTraverse ¶
func (o *Observer) OnGraphTraverse(ctx context.Context, backend string, depth int, nodeCount int, latencyMS int64)
OnGraphTraverse implements retrieve.Observer.
func (*Observer) OnRerank ¶
func (o *Observer) OnRerank(ctx context.Context, model string, inputCount int, outputCount int, latencyMS int64)
OnRerank implements retrieve.Observer.
func (*Observer) OnRetrieveEnd ¶
OnRetrieveEnd implements retrieve.Observer.
func (*Observer) OnRetrieveStart ¶
OnRetrieveStart implements retrieve.Observer.
type ObserverConfig ¶
type ObserverConfig struct {
// Exporters to send spans to.
Exporters []SpanExporter
// Logger for observer errors.
Logger *slog.Logger
}
ObserverConfig configures the Observer.
type Span ¶
type Span struct {
// ID is the unique span identifier.
ID string
// TraceID links spans in the same trace.
TraceID string
// ParentID is the parent span ID (empty for root).
ParentID string
// Type identifies the operation type.
Type SpanType
// Name is the human-readable span name.
Name string
// StartTime is when the span started.
StartTime time.Time
// EndTime is when the span ended.
EndTime time.Time
// Attributes are key-value pairs for this span.
Attributes map[string]any
// Artifacts are larger objects attached to this span.
Artifacts map[string]any
// Status indicates success or failure.
Status SpanStatus
// Error contains error details if Status is Error.
Error string
}
Span represents a traced operation.
type SpanContext ¶
SpanContext holds the current span information in context.
func FromContext ¶
func FromContext(ctx context.Context) *SpanContext
FromContext extracts SpanContext from context.
type SpanExporter ¶
type SpanExporter interface {
// Export sends spans to the backend.
Export(ctx context.Context, spans []Span) error
// Name returns the exporter name.
Name() string
}
SpanExporter exports spans to an observability backend.
type SpanStatus ¶
type SpanStatus string
SpanStatus indicates the outcome of a span.
const ( SpanStatusOK SpanStatus = "ok" SpanStatusError SpanStatus = "error" )