rag

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package rag instruments retrieval capabilities with OpenTelemetry.

Index

Constants

This section is empty.

Variables

View Source
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.

func (Middleware) Wrap

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.

Jump to

Keyboard shortcuts

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