Netra Environment Variables
These variables are specific to the Netra SDK:Authentication and Endpoint
| Variable | Description | Example |
|---|---|---|
NETRA_API_KEY | API key for authenticating with Netra | ntr_abc123... |
NETRA_OTLP_ENDPOINT | OTLP endpoint URL for sending traces | See region endpoints below |
NETRA_HEADERS | Custom headers in W3C Correlation-Context format | x-api-key=abc123,x-custom=value |
| Region | Endpoint |
|---|---|
| US | https://api.getnetra.ai/telemetry |
| EU | https://api.eu.getnetra.ai/telemetry |
Application Identity
| Variable | Description | Example |
|---|---|---|
NETRA_APP_NAME | Name of your application | my-ai-service |
NETRA_ENV | Deployment environment | production, staging, development |
Tracing Behavior
| Variable | Description | Default |
|---|---|---|
NETRA_TRACE_CONTENT | Capture prompt/completion content (true/false) | true |
NETRA_DISABLE_BATCH | Send spans immediately without batching (true/false) | false |
NETRA_ENABLE_ROOT_SPAN | Create long-lived root span (true/false) | false |
NETRA_ENABLE_SCRUBBING | Enable PII scrubbing (Python only) (true/false) | false |
NETRA_DEBUG | Enable debug logging (true/false) | false |
Attribute Limits
| Variable | Description | Default |
|---|---|---|
NETRA_ATTRIBUTE_MAX_LEN | Maximum length for span attribute values | 50000 |
NETRA_CONVERSATION_CONTENT_MAX_LEN | Maximum length for conversation content | 50000 |
Resource Attributes
| Variable | Description | Example |
|---|---|---|
NETRA_RESOURCE_ATTRS | JSON string of custom resource attributes | {"team":"ml","version":"1.0"} |
OpenTelemetry Environment Variables
Netra also respects standard OpenTelemetry environment variables. These serve as fallbacks when Netra-specific variables are not set.| Variable | Netra Equivalent | Description |
|---|---|---|
OTEL_SERVICE_NAME | NETRA_APP_NAME | Service/application name |
OTEL_EXPORTER_OTLP_ENDPOINT | NETRA_OTLP_ENDPOINT | OTLP exporter endpoint |
OTEL_EXPORTER_OTLP_HEADERS | NETRA_HEADERS | OTLP exporter headers |
OTEL_RESOURCE_ATTRIBUTES | NETRA_RESOURCE_ATTRS | Resource attributes |
Configuration Precedence
When the same setting is configured in multiple places, Netra uses this priority order:-
Code parameters (highest priority)
-
Netra environment variables
-
OpenTelemetry environment variables
- Default values (lowest priority)
Example
Environment-Specific Configuration
Development
Staging
Production
Loading Environment Variables
Python
TypeScript/Node.js
Docker and Kubernetes
Docker
Docker Compose
Kubernetes
Complete Reference
| Variable | Type | Default | Description |
|---|---|---|---|
NETRA_API_KEY | string | - | API key for authentication |
NETRA_OTLP_ENDPOINT | string | - | OTLP endpoint URL |
NETRA_HEADERS | string | - | Custom headers (W3C format) |
NETRA_APP_NAME | string | - | Application name |
NETRA_ENV | string | default | Environment name |
NETRA_TRACE_CONTENT | boolean | true | Capture prompt/completion content |
NETRA_DISABLE_BATCH | boolean | false | Disable span batching |
NETRA_ENABLE_ROOT_SPAN | boolean | false | Enable root span |
NETRA_ENABLE_SCRUBBING | boolean | false | Enable PII scrubbing (Python) |
NETRA_DEBUG | boolean | false | Enable debug logging |
NETRA_ATTRIBUTE_MAX_LEN | integer | 50000 | Max attribute length |
NETRA_CONVERSATION_CONTENT_MAX_LEN | integer | 50000 | Max conversation length |
NETRA_RESOURCE_ATTRS | JSON string | {} | Custom resource attributes |
Next Steps
- Initialization - Programmatic configuration
- Instrumentation Selection - Control which libraries are traced
- Custom Exporters - Send traces to custom backends