Skip to main content
The Netra.init() function configures the SDK and starts the tracing system. Call it once at the start of your application, before making any LLM or database calls.

Quick Start

Configuration Parameters

For instrumentation control details, see Instrumentation Selection.

Complete Example

PII scrubbing (enable_scrubbing) adds processing overhead. Only enable when handling sensitive data.

Configuration Precedence

Configuration values are resolved in order of priority:
  1. Code parameters - Values passed to Netra.init()
  2. Netra environment variables - NETRA_* variables
  3. OpenTelemetry environment variables - OTEL_* variables
  4. Default values - SDK defaults

Async Initialization (TypeScript)

The Netra.init() method in TypeScript is async and waits for all instrumentations to be ready before returning. Always await the call to ensure proper instrumentation:
TypeScript
Always await Netra.init() to ensure libraries like OpenAI, Anthropic, and LangGraph are properly instrumented before use. This is especially important in frameworks like NestJS where modules are loaded after initialization.

Shutdown

Ensure all pending spans are exported before application exit:
Always call shutdown() before exit, especially for short-lived processes like serverless functions.

Next Steps

Last modified on March 17, 2026