Skip to main content
To trace LlamaIndex with HoneyHive, install honeyhive, openinference-instrumentation-llama-index, and llama-index, call HoneyHiveTracer.init(), run LlamaIndexInstrumentor().instrument(tracer_provider=tracer.provider), and use your existing LlamaIndex code unchanged. See the tracing quickstart and tracer initialization guides for setup details. LlamaIndex is a data framework for building LLM applications with retrieval-augmented generation (RAG), agents, and structured data extraction. It provides query engines, retrievers, and composable pipelines. HoneyHive integrates with LlamaIndex via the OpenInference instrumentor, automatically capturing query engine operations, LLM calls, retrieval, embeddings, and more.

How do I trace LlamaIndex with HoneyHive?

To see where to initialize the tracer for your environment, including AWS Lambda and long-running servers, see Tracer Initialization.
uv pip install honeyhive openinference-instrumentation-llama-index llama-index
import os
from honeyhive import HoneyHiveTracer
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor

tracer = HoneyHiveTracer.init(api_key=os.getenv("HH_API_KEY"))
LlamaIndexInstrumentor().instrument(tracer_provider=tracer.provider)
Set HH_API_KEY. The example below also needs OPENAI_API_KEY.

RAG example

Create a small source file before running the example:
echo "Key finding: HoneyHive traces LlamaIndex query engines." > data.txt
import os
from honeyhive import HoneyHiveTracer
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.llms.openai import OpenAI

tracer = HoneyHiveTracer.init(api_key=os.getenv("HH_API_KEY"))
LlamaIndexInstrumentor().instrument(tracer_provider=tracer.provider)

Settings.llm = OpenAI(model="gpt-4o-mini")
Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-small")

documents = SimpleDirectoryReader(input_files=["data.txt"]).load_data()
index = VectorStoreIndex.from_documents(documents)

query_engine = index.as_query_engine()
response = query_engine.query("What are the key findings?")
print(response)
HoneyHive shows the query engine call, embedding calls, retrieval with document nodes, and LLM synthesis.

Troubleshooting

Traces not appearing

  • Call instrument() before creating LlamaIndex indexes, retrievers, or query engines.
  • Pass tracer_provider=tracer.provider, especially if your app uses multiple OpenTelemetry providers or instrumentors.
  • Confirm HH_API_KEY is set. For OpenAI-backed examples, confirm OPENAI_API_KEY is set.

Resources