netra-sdk 1.11.0 → 1.12.0
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 +21 -0
- package/dist/index.cjs +641 -40188
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +595 -266
- package/dist/index.js.map +1 -1
- package/package.json +20 -17
- package/dist/chunk-LRCHNZDG.js +0 -419
- package/dist/chunk-LRCHNZDG.js.map +0 -1
- package/dist/chunk-TFPEWHM4.js +0 -564
- package/dist/chunk-TFPEWHM4.js.map +0 -1
- package/dist/dist-4UBY6Q6Z.js +0 -21658
- package/dist/dist-4UBY6Q6Z.js.map +0 -1
- package/dist/manager-BKZT7MYF.js +0 -15991
- package/dist/manager-BKZT7MYF.js.map +0 -1
package/README.md
CHANGED
|
@@ -40,6 +40,27 @@ await Netra.init({
|
|
|
40
40
|
|
|
41
41
|
> **Note**: Always `await` the `init()` call to ensure all instrumentations (like OpenAI, Anthropic, LangGraph) are fully patched before your application starts using them. This is especially important in frameworks like NestJS where modules are loaded after initialization.
|
|
42
42
|
|
|
43
|
+
#### Shutdown
|
|
44
|
+
|
|
45
|
+
By default, `init()` flushes pending spans (for up to 5 seconds) when the process receives `SIGINT`/`SIGTERM`, crashes, or exits naturally. If your app handles these events itself, it stays in control; otherwise Node's default behaviour applies after the flush. To manage shutdown yourself, opt out and call `Netra.shutdown()`:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
await Netra.init({ appName: "my-ai-app", registerShutdownHooks: false });
|
|
49
|
+
|
|
50
|
+
process.on("SIGTERM", async () => {
|
|
51
|
+
await new Promise((resolve) => server.close(resolve));
|
|
52
|
+
await Netra.shutdown(); // flush pending spans
|
|
53
|
+
process.exit(0);
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`Netra.shutdown()` is safe to call more than once or from several places at the same time.
|
|
58
|
+
|
|
59
|
+
> **Notes**
|
|
60
|
+
> - If your app has its own `uncaughtException` handler, the SDK leaves crashes to it and does not flush; call `Netra.shutdown()` there before exiting.
|
|
61
|
+
> - If a library keeps a permanent signal listener (e.g. via `signal-exit`), `SIGTERM` may not stop the process. Use `registerShutdownHooks: false` and call `Netra.shutdown()` yourself.
|
|
62
|
+
> - With `registerShutdownHooks: false`, a running simulation still listens for these events briefly so an interrupted run is marked `failed`.
|
|
63
|
+
|
|
43
64
|
## 🎯 Decorators
|
|
44
65
|
|
|
45
66
|
Use decorators to automatically trace your functions and classes.
|