Skip to content

datarobot_genai.llama_index.telemetry

telemetry

Idempotent LlamaIndex auto-instrumentation for agent telemetry.

instrument

instrument() -> None

Idempotently enable the LlamaIndex OpenTelemetry instrumentor.

Source code in datarobot_genai/llama_index/telemetry.py
def instrument() -> None:
    """Idempotently enable the LlamaIndex OpenTelemetry instrumentor."""
    if _INSTRUMENTED["llamaindex"]:
        logger.info("LlamaIndex instrumentation already enabled")
        return
    try:
        LlamaIndexInstrumentor().instrument()
        _INSTRUMENTED["llamaindex"] = True
    except Exception as e:
        logger.info(f"LlamaIndex instrumentation failed: {e}")