netra-sdk 1.12.1 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,6 +22,19 @@ npm install netra-sdk
22
22
 
23
23
  ## 🚀 Quick Start
24
24
 
25
+ ### Set the Endpoint and API Key
26
+
27
+ Set these before you call `Netra.init()`, wherever your app runs (your shell, Docker containers, CI jobs). Without `NETRA_OTLP_ENDPOINT`, the SDK prints spans to the console instead of sending them to Netra, and your dashboard stays empty.
28
+
29
+ ```bash
30
+ # US region
31
+ export NETRA_OTLP_ENDPOINT="https://api.getnetra.ai/telemetry"
32
+ # EU region: export NETRA_OTLP_ENDPOINT="https://api.eu.getnetra.ai/telemetry"
33
+ export NETRA_API_KEY="your-api-key-here"
34
+ ```
35
+
36
+ If the endpoint is not set, the SDK prints a warning at startup that names `NETRA_OTLP_ENDPOINT`. See [Logging](#-logging).
37
+
25
38
  ### Basic Setup
26
39
 
27
40
  Initialize the Netra SDK at the start of your application (entry point). The `init()` method is async and waits for all instrumentations to be ready before returning:
@@ -31,7 +44,7 @@ import { Netra, NetraInstruments } from "netra-sdk";
31
44
 
32
45
  await Netra.init({
33
46
  appName: "my-ai-app",
34
- headers: `x-api-key=${process.env.NETRA_API_KEY}`, // Optional: Send traces to Netra Platform
47
+ headers: `x-api-key=${process.env.NETRA_API_KEY}`,
35
48
  environment: "production",
36
49
  // Optional: Select specific instruments
37
50
  instruments: new Set([NetraInstruments.OPENAI, NetraInstruments.LANGCHAIN]),
@@ -279,10 +292,18 @@ You can configure the SDK using environment variables:
279
292
 
280
293
  | Variable | Description |
281
294
  |----------|-------------|
295
+ | `NETRA_OTLP_ENDPOINT` | Netra endpoint: `https://api.getnetra.ai/telemetry` (US) or `https://api.eu.getnetra.ai/telemetry` (EU). Required to send traces to Netra; falls back to `OTEL_EXPORTER_OTLP_ENDPOINT`, and if neither is set, spans are printed to the console |
282
296
  | `NETRA_API_KEY` | API Key for Netra Platform |
283
297
  | `NETRA_APP_NAME` | Name of your application |
284
298
  | `NETRA_ENV` | Environment (e.g., prod, dev) |
285
299
  | `NETRA_TRACE_CONTENT` | Capture prompt/completion content (default: true) |
300
+ | `NETRA_DEBUG` | Enable debug logging (default: false) |
301
+
302
+ ## 📝 Logging
303
+
304
+ Outside debug mode the SDK keeps its internal logs quiet. Problems you have to fix are still printed through `console.warn` or `console.error`, with the `[Netra]` prefix. They include a missing `NETRA_OTLP_ENDPOINT` or `NETRA_API_KEY`, span batches that were dropped, invalid arguments to public methods, and failed Netra API calls.
305
+
306
+ To see the SDK's full internal logs, pass `debugMode: true` to `Netra.init()` or set `NETRA_DEBUG=true`.
286
307
 
287
308
  ## 🤝 License
288
309