Skip to main content
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.

Quick Start

Add HoneyHive tracing in just 4 lines of code. Add this to your existing LlamaIndex app and all query engine operations, LLM calls, and retrieval are automatically traced.
To see where to initialize the tracer for your environment, including AWS Lambda and long-running servers, see Tracer Initialization.
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)

# Your existing LlamaIndex code works unchanged

What Gets Traced

The instrumentor automatically captures:
  • Query engine operations - query_engine.query() with inputs and outputs
  • LLM calls - Chat completions and text completions with messages, responses, and token usage
  • Retrieval - Document retrieval with query text and retrieved nodes
  • Embeddings - Embedding generation for queries and documents
  • Synthesis - Response synthesis from retrieved context
  • Agent steps - Agent reasoning iterations and tool calls
  • Re-ranking - Re-ranker invocations with input and output node orderings
  • Streaming - Streamed LLM and chat engine responses
No manual instrumentation required.

Example: RAG Query Engine

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()

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)
In HoneyHive, you’ll see the full trace hierarchy: query engine call, retrieval with retrieved document nodes, and LLM synthesis of the final response.

Troubleshooting

Traces not appearing

  1. Pass the tracer provider - The instrumentor must receive tracer_provider=tracer.provider:
from honeyhive import HoneyHiveTracer
from openinference.instrumentation.llama_index import LlamaIndexInstrumentor

tracer = HoneyHiveTracer.init(api_key=os.getenv("HH_API_KEY"))

# Correct - pass tracer_provider
LlamaIndexInstrumentor().instrument(tracer_provider=tracer.provider)

# Wrong - missing tracer_provider
LlamaIndexInstrumentor().instrument()
  1. Check environment variables - Ensure HH_API_KEY is set
  2. Initialize before building indexes - Call instrument() before creating indexes or query engines

Enrich Your Traces

Add user IDs and custom metadata to LlamaIndex traces

Custom Spans

Create spans for business logic around query engine calls

Distributed Tracing

Trace pipelines across service boundaries

Resources