Skip to main content
By default, Netra instruments a curated set of AI-relevant libraries detected in your application. You can customize this behavior to enable only specific instrumentations, block certain ones, or opt into instrumenting all available libraries.

How It Works

Netra provides three parameters for controlling instrumentations:
Use instruments when you want a minimal setup with only specific libraries traced. Use block_instruments when you want the curated defaults but need to exclude a few. Use root_instruments to control which libraries can start new top-level traces.

The ALL Sentinel

Pass NetraInstruments.ALL to restore the legacy behavior of instrumenting every supported library found in your environment:
Python
ALL can be used in instruments, root_instruments, and block_instruments. When present in block_instruments, it blocks all instrumentations.

Enabling Specific Instrumentations

Use the instruments parameter to enable only the instrumentations you need:

Blocking Specific Instrumentations

Use block_instruments to exclude certain instrumentations while keeping the curated defaults:

Controlling Root-Level Spans

Use root_instruments (rootInstruments in TypeScript) to control which libraries can produce root-level spans. It is independent of instruments, and defaults to the curated DEFAULT_INSTRUMENTS_FOR_ROOT subset (LLM providers and AI frameworks) when omitted.
Pass the ALL sentinel to root_instruments / rootInstruments to let every instrumentation produce root spans (legacy behavior). When a root span is enabled via enable_root_span / enableRootSpan, Netra attaches its own root span and every auto-instrumentation span becomes its child, so root_instruments has no effect.
When a root span comes from an instrumentation outside the allowed set, only the disallowed root span is dropped: its children are reparented onto its parent so nested LLM and vector spans are kept. Use this to filter out noisy top-level traces from HTTP clients, web frameworks, or database drivers.

Available Instruments

Python Instruments

LLM Providers

AI Frameworks

Vector Databases

HTTP Clients

Web Frameworks

Databases

Message Queues

TypeScript Instruments

LLM Providers

AI Frameworks

Vector Databases

HTTP Clients

Web Frameworks

Databases

Message Queues

Common Use Cases

LLM-Only Tracing

Trace only LLM provider calls, ignoring HTTP, database, and framework instrumentation:

Reduce HTTP Noise

Block HTTP client instrumentation to reduce trace noise while keeping everything else:

RAG Application

Instrument only what’s needed for a typical RAG application:

API Service

Instrument a FastAPI/Express service with database and LLM calls:

Best Practices

  1. Start broad, then narrow - Begin with default instrumentation (all libraries), then use block_instruments to remove noisy ones.
  2. Use instruments for minimal setups - When you know exactly which libraries you need traced, use instruments for a cleaner configuration.
  3. Block HTTP for cleaner traces - HTTP instrumentation can create many spans. Block it if you don’t need to trace external API calls.
  4. Match your dependencies - Only include instruments for libraries you actually use. Extra instruments have minimal overhead but can cause confusion.
  5. Document your choices - Add comments explaining why certain instrumentations are enabled or blocked.

Troubleshooting

Instrumentation not working

  1. Check library installation order - Initialize Netra before importing the library you want to instrument.
  2. Verify the instrument name - Ensure you’re using the correct enum value for your SDK version.
  3. Enable debug mode - Use debug_mode=True to see which instrumentations are being loaded.

Too many spans

  1. Block HTTP clients - HTTP instrumentation often creates the most spans.
  2. Use instruments - Switch from blocking to allowlisting for more control.
  3. Use blocked_spans - Filter specific span names at export time (see Initialization).

Next Steps

Last modified on July 17, 2026