netra-sdk 1.11.0 → 1.12.1
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 +681 -40195
- 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 +636 -274
- 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/dist/index.d.cts
CHANGED
|
@@ -36,6 +36,19 @@ interface NetraConfig {
|
|
|
36
36
|
* to produce root spans (legacy behaviour).
|
|
37
37
|
*/
|
|
38
38
|
rootInstruments?: Set<NetraInstruments>;
|
|
39
|
+
/**
|
|
40
|
+
* Register process hooks (`SIGINT`, `SIGTERM`, `uncaughtException`,
|
|
41
|
+
* `beforeExit`) that flush pending spans when the process is going away.
|
|
42
|
+
* The hooks never exit the process themselves while the application has
|
|
43
|
+
* its own handlers for the same event. Defaults to `true`; set to `false`
|
|
44
|
+
* to manage shutdown yourself via `Netra.shutdown()`.
|
|
45
|
+
*
|
|
46
|
+
* This covers the span-flushing hooks only. A simulation run still registers
|
|
47
|
+
* short-lived exit hooks of its own so an interrupted run is marked `failed`
|
|
48
|
+
* instead of being left `running`; those are removed when the run ends and
|
|
49
|
+
* likewise never override an application that handles the event itself.
|
|
50
|
+
*/
|
|
51
|
+
registerShutdownHooks?: boolean;
|
|
39
52
|
}
|
|
40
53
|
declare enum NetraInstruments {
|
|
41
54
|
/**
|
|
@@ -77,7 +90,7 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
|
|
|
77
90
|
declare class Config {
|
|
78
91
|
static readonly SDK_NAME = "netra";
|
|
79
92
|
static readonly LIBRARY_NAME = "netra";
|
|
80
|
-
static readonly LIBRARY_VERSION = "1.
|
|
93
|
+
static readonly LIBRARY_VERSION = "1.12.1";
|
|
81
94
|
static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
|
|
82
95
|
static readonly TRACE_ORIGIN_KEY = "netra.trace.origin";
|
|
83
96
|
static readonly TRACE_ORIGIN_EVALUATION = "evaluation";
|
|
@@ -529,8 +542,14 @@ declare class NetraHttpClient {
|
|
|
529
542
|
private buildHeaders;
|
|
530
543
|
private getTimeout;
|
|
531
544
|
isInitialized(): boolean;
|
|
532
|
-
|
|
533
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Build an API path, percent-encoding every interpolated value.
|
|
547
|
+
* Returns null (and logs) if a value is not a valid path segment;
|
|
548
|
+
* `get`/`post` treat a null path as a failed request.
|
|
549
|
+
*/
|
|
550
|
+
protected path(strings: TemplateStringsArray, ...values: unknown[]): string | null;
|
|
551
|
+
get<T = any>(path: string | null, params?: Record<string, string | number | undefined>): Promise<HttpResponse<T>>;
|
|
552
|
+
post<T = any>(path: string | null, body?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
534
553
|
/**
|
|
535
554
|
* Extract data from nested response format
|
|
536
555
|
* Netra API typically returns { data: { data: actualData } }
|
|
@@ -1853,6 +1872,10 @@ declare class Netra {
|
|
|
1853
1872
|
private static _config;
|
|
1854
1873
|
private static _tracer;
|
|
1855
1874
|
private static _metricsEnabled;
|
|
1875
|
+
private static _shutdownPromise;
|
|
1876
|
+
private static _unregisterFlush;
|
|
1877
|
+
private static readonly _flushTask;
|
|
1878
|
+
private static _beforeExit;
|
|
1856
1879
|
static usage: Usage;
|
|
1857
1880
|
static evaluation: Evaluation;
|
|
1858
1881
|
static dashboard: Dashboard;
|
|
@@ -1865,7 +1888,23 @@ declare class Netra {
|
|
|
1865
1888
|
* Initialize the Netra SDK.
|
|
1866
1889
|
*/
|
|
1867
1890
|
static init(config?: NetraConfig): Promise<void>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Flush spans when the host process is going away, without taking over
|
|
1893
|
+
* the process lifecycle: the SDK never decides when (or with which code)
|
|
1894
|
+
* the process exits. Once flushed, if no other listener is handling the
|
|
1895
|
+
* event, Node's default behaviour is restored (the signal is re-raised so
|
|
1896
|
+
* the exit code is 128+n; an uncaught exception exits with code 1).
|
|
1897
|
+
*/
|
|
1898
|
+
private static _registerShutdownHooks;
|
|
1899
|
+
private static _removeShutdownHooks;
|
|
1900
|
+
/**
|
|
1901
|
+
* Flush pending spans and release SDK resources. Safe to call more than
|
|
1902
|
+
* once and from several places at the same time (e.g. the app's own SIGTERM
|
|
1903
|
+
* handler while the SDK's hook is also flushing): concurrent callers share
|
|
1904
|
+
* the same in-flight shutdown and all resolve once it has finished.
|
|
1905
|
+
*/
|
|
1868
1906
|
static shutdown(): Promise<void>;
|
|
1907
|
+
private static _shutdown;
|
|
1869
1908
|
static getTraceId(): string | undefined;
|
|
1870
1909
|
static setInput(value: any): void;
|
|
1871
1910
|
static setOutput(value: any): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,19 @@ interface NetraConfig {
|
|
|
36
36
|
* to produce root spans (legacy behaviour).
|
|
37
37
|
*/
|
|
38
38
|
rootInstruments?: Set<NetraInstruments>;
|
|
39
|
+
/**
|
|
40
|
+
* Register process hooks (`SIGINT`, `SIGTERM`, `uncaughtException`,
|
|
41
|
+
* `beforeExit`) that flush pending spans when the process is going away.
|
|
42
|
+
* The hooks never exit the process themselves while the application has
|
|
43
|
+
* its own handlers for the same event. Defaults to `true`; set to `false`
|
|
44
|
+
* to manage shutdown yourself via `Netra.shutdown()`.
|
|
45
|
+
*
|
|
46
|
+
* This covers the span-flushing hooks only. A simulation run still registers
|
|
47
|
+
* short-lived exit hooks of its own so an interrupted run is marked `failed`
|
|
48
|
+
* instead of being left `running`; those are removed when the run ends and
|
|
49
|
+
* likewise never override an application that handles the event itself.
|
|
50
|
+
*/
|
|
51
|
+
registerShutdownHooks?: boolean;
|
|
39
52
|
}
|
|
40
53
|
declare enum NetraInstruments {
|
|
41
54
|
/**
|
|
@@ -77,7 +90,7 @@ declare const DEFAULT_INSTRUMENTS: Set<NetraInstruments>;
|
|
|
77
90
|
declare class Config {
|
|
78
91
|
static readonly SDK_NAME = "netra";
|
|
79
92
|
static readonly LIBRARY_NAME = "netra";
|
|
80
|
-
static readonly LIBRARY_VERSION = "1.
|
|
93
|
+
static readonly LIBRARY_VERSION = "1.12.1";
|
|
81
94
|
static readonly TRIAL_BLOCK_DURATION_SECONDS = 900;
|
|
82
95
|
static readonly TRACE_ORIGIN_KEY = "netra.trace.origin";
|
|
83
96
|
static readonly TRACE_ORIGIN_EVALUATION = "evaluation";
|
|
@@ -529,8 +542,14 @@ declare class NetraHttpClient {
|
|
|
529
542
|
private buildHeaders;
|
|
530
543
|
private getTimeout;
|
|
531
544
|
isInitialized(): boolean;
|
|
532
|
-
|
|
533
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Build an API path, percent-encoding every interpolated value.
|
|
547
|
+
* Returns null (and logs) if a value is not a valid path segment;
|
|
548
|
+
* `get`/`post` treat a null path as a failed request.
|
|
549
|
+
*/
|
|
550
|
+
protected path(strings: TemplateStringsArray, ...values: unknown[]): string | null;
|
|
551
|
+
get<T = any>(path: string | null, params?: Record<string, string | number | undefined>): Promise<HttpResponse<T>>;
|
|
552
|
+
post<T = any>(path: string | null, body?: Record<string, any>): Promise<HttpResponse<T>>;
|
|
534
553
|
/**
|
|
535
554
|
* Extract data from nested response format
|
|
536
555
|
* Netra API typically returns { data: { data: actualData } }
|
|
@@ -1853,6 +1872,10 @@ declare class Netra {
|
|
|
1853
1872
|
private static _config;
|
|
1854
1873
|
private static _tracer;
|
|
1855
1874
|
private static _metricsEnabled;
|
|
1875
|
+
private static _shutdownPromise;
|
|
1876
|
+
private static _unregisterFlush;
|
|
1877
|
+
private static readonly _flushTask;
|
|
1878
|
+
private static _beforeExit;
|
|
1856
1879
|
static usage: Usage;
|
|
1857
1880
|
static evaluation: Evaluation;
|
|
1858
1881
|
static dashboard: Dashboard;
|
|
@@ -1865,7 +1888,23 @@ declare class Netra {
|
|
|
1865
1888
|
* Initialize the Netra SDK.
|
|
1866
1889
|
*/
|
|
1867
1890
|
static init(config?: NetraConfig): Promise<void>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Flush spans when the host process is going away, without taking over
|
|
1893
|
+
* the process lifecycle: the SDK never decides when (or with which code)
|
|
1894
|
+
* the process exits. Once flushed, if no other listener is handling the
|
|
1895
|
+
* event, Node's default behaviour is restored (the signal is re-raised so
|
|
1896
|
+
* the exit code is 128+n; an uncaught exception exits with code 1).
|
|
1897
|
+
*/
|
|
1898
|
+
private static _registerShutdownHooks;
|
|
1899
|
+
private static _removeShutdownHooks;
|
|
1900
|
+
/**
|
|
1901
|
+
* Flush pending spans and release SDK resources. Safe to call more than
|
|
1902
|
+
* once and from several places at the same time (e.g. the app's own SIGTERM
|
|
1903
|
+
* handler while the SDK's hook is also flushing): concurrent callers share
|
|
1904
|
+
* the same in-flight shutdown and all resolve once it has finished.
|
|
1905
|
+
*/
|
|
1868
1906
|
static shutdown(): Promise<void>;
|
|
1907
|
+
private static _shutdown;
|
|
1869
1908
|
static getTraceId(): string | undefined;
|
|
1870
1909
|
static setInput(value: any): void;
|
|
1871
1910
|
static setOutput(value: any): void;
|