1- # OpenTelemetry and Zipkin Integration for LazyGraphRAG
1+ # OpenTelemetry and Zipkin Integration for GraphRAG
22
3- This module provides comprehensive observability for LazyGraphRAG using OpenTelemetry with Zipkin as the tracing backend.
3+ This module provides comprehensive observability for GraphRAG using OpenTelemetry with Zipkin as the tracing backend.
44
55## Features
66
@@ -39,13 +39,13 @@ docker run -d -p 9411:9411 openzipkin/zipkin
3939
4040Zipkin UI will be available at: http://localhost:9411/zipkin
4141
42- ### 3. Use LazyGraphRAG (Automatic Setup)
42+ ### 3. Use GraphRAG (Automatic Setup)
4343
44- Telemetry is automatically enabled when you import LazyGraphRAG :
44+ Telemetry is automatically enabled when you import GraphRAG :
4545
4646``` python
47- from lazy_graphrag .api.index import build_index
48- from lazy_graphrag .api.query import lazy_search
47+ from graphrag .api.index import build_index
48+ from graphrag .api.query import lazy_search
4949
5050# Telemetry is automatically set up!
5151# Your operations will be traced to Zipkin
@@ -85,7 +85,7 @@ export GRAPHRAG_DISABLE_TELEMETRY="false"
8585### Programmatic Configuration
8686
8787``` python
88- from lazy_graphrag .telemetry import TelemetryConfig, setup_telemetry
88+ from graphrag .telemetry import TelemetryConfig, setup_telemetry
8989
9090config = TelemetryConfig(
9191 service_name = " my-graphrag-service" ,
@@ -98,48 +98,17 @@ config = TelemetryConfig(
9898setup_telemetry(config)
9999```
100100
101- ## Tracing Coverage
102-
103- ### Automatically Traced Operations
104-
105- The following operations are automatically traced:
106-
107- 1 . ** API Operations**
108- - ` build_index() ` - Complete indexing pipeline with ` @trace ` decorator
109- - Query processing operations
110-
111- 2 . ** Workflow Operations**
112- - ` create_communities ` - Community detection workflow with ` @trace_workflow ` decorator
113- - ` load_input_documents ` - Document loading workflow with ` @trace_workflow ` decorator
114- - Other workflows can be traced by adding ` @trace_workflow("workflow_name") ` decorator
115-
116- 3 . ** Search Operations**
117- - ` local_search() ` - Local search with ` @trace_search_operation ` decorator
118- - ` global_search() ` - Global search with ` @trace_search_operation ` decorator
119- - ` drift_search() ` - DRIFT search (can be instrumented)
120- - ` basic_search() ` - Basic search (can be instrumented)
121-
122- 4 . ** Storage Operations** (via automatic instrumentation)
123- - PostgreSQL operations
124- - HTTP requests to external services
125- - AsyncPG database operations
126-
127- 5 . ** Vector Store Operations** (via automatic instrumentation)
128- - Milvus vector operations
129- - HTTP client requests
130-
131101### Custom Tracing
132102
133103Add tracing to your own functions:
134104
135105``` python
136106from graphrag.telemetry.decorators import (
137- trace ,
107+ add_trace ,
138108 trace_workflow,
139109 trace_vector_store_operation,
140110 trace_llm_operation,
141- trace_search_operation,
142- trace_retrieval_operation
111+ trace_search_operation
143112)
144113
145114@add_trace (" my_custom_function" )
@@ -166,11 +135,6 @@ async def vector_search():
166135async def call_llm ():
167136 """ LLM operation tracing."""
168137 pass
169-
170- @trace_retrieval_operation (" l1_ranking" )
171- async def retrieval_operation ():
172- """ Retrieval operation tracing."""
173- pass
174138```
175139
176140### Adding Telemetry to New Workflows
@@ -234,7 +198,7 @@ Function arguments are automatically captured as attributes:
234198Add custom attributes to traces:
235199
236200``` python
237- from lazy_graphrag .telemetry.setup import get_tracer
201+ from graphrag .telemetry.setup import get_tracer
238202from opentelemetry import trace
239203
240204tracer = get_tracer(__name__ )
@@ -281,7 +245,7 @@ export OTEL_ENABLE_METRICS="false"
281245
2822462 . ** Telemetry setup failures**
283247 - Check logs for warning messages
284- - Telemetry failures don't stop LazyGraphRAG execution
248+ - Telemetry failures don't stop GraphRAG execution
285249 - Verify OpenTelemetry dependencies are installed
286250
2872513 . ** High overhead**
@@ -294,15 +258,15 @@ Enable debug logging:
294258
295259``` python
296260import logging
297- logging.getLogger(" lazy_graphrag .telemetry" ).setLevel(logging.DEBUG )
261+ logging.getLogger(" graphrag .telemetry" ).setLevel(logging.DEBUG )
298262```
299263
300264### Health Check
301265
302266Verify telemetry setup:
303267
304268``` python
305- from lazy_graphrag .telemetry.setup import get_tracer
269+ from graphrag .telemetry.setup import get_tracer
306270
307271tracer = get_tracer(" test" )
308272with tracer.start_as_current_span(" health_check" ) as span:
@@ -331,8 +295,8 @@ with tracer.start_as_current_span("health_check") as span:
331295
332296``` python
333297import asyncio
334- from lazy_graphrag .api.index import build_index
335- from lazy_graphrag .config.load_config import load_config
298+ from graphrag .api.index import build_index
299+ from graphrag .config.load_config import load_config
336300
337301async def main ():
338302 # Load config
@@ -370,7 +334,7 @@ span_processor = BatchSpanProcessor(jaeger_exporter)
370334Add custom metrics:
371335
372336``` python
373- from lazy_graphrag .telemetry.setup import get_meter
337+ from graphrag .telemetry.setup import get_meter
374338
375339meter = get_meter(__name__ )
376340counter = meter.create_counter(" custom_operations" )
0 commit comments