Skip to main content

Observability Tracing

Distributed tracing system for monitoring and debugging RecoAgent applications.

Overview

The observability tracing system provides comprehensive distributed tracing capabilities for monitoring request flows, performance bottlenecks, and system behavior.

Core Features

  • Distributed Tracing: Track requests across multiple services
  • Performance Monitoring: Monitor latency and throughput
  • Error Tracking: Track and analyze errors
  • Integration: LangSmith and custom tracing support

Usage Examples

Basic Tracing Setup

from recoagent.observability.tracing import TracingManager

# Create tracing manager
tracing_manager = TracingManager()

# Start trace
with tracing_manager.start_trace("user_query_processing") as trace:
# Process query
result = process_query("What is machine learning?")
trace.add_metadata({"query_length": len("What is machine learning?")})

Advanced Tracing

# Create span for specific operation
with tracing_manager.create_span("rag_retrieval") as span:
# Perform retrieval
documents = retrieve_documents(query)
span.add_attributes({
"documents_found": len(documents),
"retrieval_time": time.time() - start_time
})

API Reference

TracingManager Methods

start_trace(name: str) -> Trace

Start a new trace

Parameters:

  • name (str): Trace name

Returns: Trace context manager

create_span(name: str) -> Span

Create a new span

Parameters:

  • name (str): Span name

Returns: Span context manager

See Also