Netra.init(), the SDK automatically instruments a curated default set of AI-relevant libraries in your application—covering LLM providers, agent frameworks, vector databases, and key web frameworks—capturing traces without requiring any code changes.
Netra does not instrument every library in your environment by default. Only a curated set of AI-relevant libraries (
DEFAULT_INSTRUMENTS) is enabled out of the box. See Selective Instrumentation for details.How It Works
Netra uses monkey-patching to intercept calls to supported libraries at runtime. When your application makes a call to an LLM provider, vector database, or HTTP client, Netra automatically:- Creates a span for the operation
- Captures input parameters (prompts, queries, etc.)
- Records output data (completions, results, etc.)
- Measures latency and performance metrics
- Tracks token usage and costs (for LLM calls)
Quick Start
Initialize Netra at the start of your application to enable auto-instrumentation:For best results, initialize Netra before importing the libraries you want to instrument. This ensures all calls are captured from the start.
What Gets Captured
For each instrumented call, Netra captures relevant attributes based on the operation type:LLM Calls
Vector Database Operations
HTTP Requests
Controlling Content Capture
By default, Netra captures prompt and completion content. You can disable this for privacy or compliance reasons:trace_content is disabled, Netra still captures:
- Token counts and usage metrics
- Latency and performance data
- Model names and configuration
- Error information
Selective Instrumentation
You can control which libraries are instrumented. See Instrumentation Selection for details on:- Enabling only specific instrumentations
- Blocking certain instrumentations
- Fine-tuning what gets captured
Combining with Manual Tracing
Auto-instrumentation works seamlessly with manual tracing. You can add custom spans and attributes to provide additional context:Supported Instrumentations
Netra supports a wide range of libraries across both Python and TypeScript. For detailed integration guides, see the Integrations section.LLM Providers
Automatically trace completions, embeddings, and other API calls to major LLM providers.AI Frameworks
Capture chain executions, agent steps, and tool calls from popular AI orchestration frameworks.Vector Databases
Track similarity searches, upserts, and other vector operations for RAG pipelines.Web Frameworks
Instrument incoming HTTP requests to trace your API endpoints end-to-end.HTTP Clients
Capture outgoing HTTP requests to external services and APIs.Databases
Monitor database queries and operations for performance analysis.Message Queues
Trace asynchronous task processing and message-based workflows.Next Steps
- Decorators - Add semantic context with
@workflow,@agent, and@task - Manual Tracing - Create custom spans for fine-grained control
- Instrumentation Selection - Control which libraries are instrumented
