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 theinstruments parameter to enable only the instrumentations you need:
Blocking Specific Instrumentations
Useblock_instruments to exclude certain instrumentations while keeping the curated defaults:
Controlling Root-Level Spans
Useroot_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.
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.
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
- Start broad, then narrow - Begin with default instrumentation (all libraries), then use
block_instrumentsto remove noisy ones. - Use
instrumentsfor minimal setups - When you know exactly which libraries you need traced, useinstrumentsfor a cleaner configuration. - Block HTTP for cleaner traces - HTTP instrumentation can create many spans. Block it if you don’t need to trace external API calls.
- Match your dependencies - Only include instruments for libraries you actually use. Extra instruments have minimal overhead but can cause confusion.
- Document your choices - Add comments explaining why certain instrumentations are enabled or blocked.
Troubleshooting
Instrumentation not working
- Check library installation order - Initialize Netra before importing the library you want to instrument.
- Verify the instrument name - Ensure you’re using the correct enum value for your SDK version.
- Enable debug mode - Use
debug_mode=Trueto see which instrumentations are being loaded.
Too many spans
- Block HTTP clients - HTTP instrumentation often creates the most spans.
- Use
instruments- Switch from blocking to allowlisting for more control. - Use
blocked_spans- Filter specific span names at export time (see Initialization).
Next Steps
- Initialization - All configuration options
- Environment Variables - Configure via environment
- Custom Exporters - Send traces to custom backends
