Skip to main content
Auto-instrumentation is the easiest way to start tracing your AI applications. When you call 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:
  1. Creates a span for the operation
  2. Captures input parameters (prompts, queries, etc.)
  3. Records output data (completions, results, etc.)
  4. Measures latency and performance metrics
  5. Tracks token usage and costs (for LLM calls)
All of this happens transparently without modifying your existing code.

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:
When 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

Last modified on May 14, 2026