Documentation
¶
Overview ¶
Package rag instruments retrieval capabilities with OpenTelemetry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidConfig = errors.New("otel/rag: invalid config") ErrInvalidRetriever = errors.New("otel/rag: invalid retriever") )
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware observes retrieval without recording query text or document content. Construct it once at the composition root and wrap only the final Retriever or branches that need distinct attribution.
func NewMiddleware ¶
func NewMiddleware(config MiddlewareConfig) (Middleware, error)
NewMiddleware fixes instrument identity and provider binding once so every retrieval contributes to the same telemetry series.
type MiddlewareConfig ¶
type MiddlewareConfig struct {
TracerProvider trace.TracerProvider
MeterProvider metric.MeterProvider
}
MiddlewareConfig takes providers rather than a tracer and meter so the choice of telemetry destination stays with the composition root. A nil provider falls back to the OpenTelemetry global, which is the convenient default for an application and the wrong one for a test that must observe only its own instruments.