This package contains the OpenTelemetry instrumentor scaffold for LlamaIndex.
pip install opentelemetry-instrumentation-genai-llama-index
from opentelemetry.instrumentation.genai.llama_index import (
LlamaIndexInstrumentor,
)
LlamaIndexInstrumentor().instrument()Content capture is controlled through the
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT environment variable.
Supported values are NO_CONTENT, SPAN_ONLY, EVENT_ONLY, and
SPAN_AND_EVENT.
Prompts and completions can also be redirected via a completion hook by
setting OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK or by passing
instrument(completion_hook=...).