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
Configuration Precedence
Configuration values are resolved in order of priority:- Code parameters - Values passed to
Netra.init() - Netra environment variables -
NETRA_*variables - OpenTelemetry environment variables -
OTEL_*variables - Default values - SDK defaults
Async Initialization (TypeScript)
TheNetra.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
- Environment Variables - Configure via environment
- Instrumentation Selection - Control which libraries are traced
- Custom Exporters - Send traces to custom backends
