@trafficwar/node 3.0.1 → 5.0.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/AGENTS.md +47 -85
- package/README.md +83 -156
- package/dist/index.cjs +211 -43893
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -28
- package/dist/index.d.ts +11 -28
- package/dist/index.js +213 -43893
- package/dist/index.js.map +1 -1
- package/package.json +1 -5
- package/THIRD-PARTY-NOTICES.md +0 -58
package/dist/index.d.cts
CHANGED
|
@@ -20,12 +20,13 @@ type S3Source = OpenString<KnownS3Provider | `${string}.${KnownS3Provider}`>;
|
|
|
20
20
|
interface TrafficWarEvent {
|
|
21
21
|
event: EventCategory;
|
|
22
22
|
event_id?: string;
|
|
23
|
-
/** RFC3339 string, epoch milliseconds, or Date.
|
|
24
|
-
timestamp
|
|
25
|
-
|
|
23
|
+
/** Actual span start: RFC3339 string, integer epoch milliseconds, or Date. */
|
|
24
|
+
timestamp: string | number | Date;
|
|
25
|
+
/** Measured duration; finite and nonnegative. */
|
|
26
|
+
latency_ms: number;
|
|
26
27
|
properties?: JsonValue;
|
|
27
28
|
user_agent?: string;
|
|
28
|
-
label
|
|
29
|
+
label: string;
|
|
29
30
|
ip?: string;
|
|
30
31
|
/**
|
|
31
32
|
* Stable emitter or dependency alias. External-service stations are keyed by
|
|
@@ -33,20 +34,20 @@ interface TrafficWarEvent {
|
|
|
33
34
|
* `<bucket>.<provider>` such as `assets.ovh-s3` when separate bucket stations
|
|
34
35
|
* are useful. Put the concrete action in `operation_type`.
|
|
35
36
|
*/
|
|
36
|
-
source
|
|
37
|
+
source: string;
|
|
37
38
|
country?: string;
|
|
38
39
|
city?: string;
|
|
39
40
|
trace_id?: string;
|
|
40
41
|
distinct_id?: string;
|
|
41
42
|
path?: string;
|
|
42
|
-
/** RFC HTTP token, normalized to uppercase after trimming. */
|
|
43
|
+
/** Required for HTTP events. RFC HTTP token, normalized to uppercase after trimming. */
|
|
43
44
|
http_method?: string;
|
|
44
45
|
error?: string;
|
|
45
46
|
exception?: string;
|
|
46
47
|
error_code?: string;
|
|
47
|
-
span_kind
|
|
48
|
+
span_kind: SpanKind;
|
|
48
49
|
/** Concrete work performed, such as `route.handler` or `google.routes.compute`. */
|
|
49
|
-
operation_type
|
|
50
|
+
operation_type: OperationType;
|
|
50
51
|
status_code?: number;
|
|
51
52
|
}
|
|
52
53
|
type CompressionMode = "auto" | "gzip" | "none";
|
|
@@ -57,7 +58,7 @@ interface TrafficWarQueueOptions {
|
|
|
57
58
|
flushIntervalMs?: number;
|
|
58
59
|
/** Maximum number of unacknowledged events held by this client. */
|
|
59
60
|
maxQueueSize?: number;
|
|
60
|
-
/** Receives
|
|
61
|
+
/** Receives automatic event-delivery and catalog-registration errors. */
|
|
61
62
|
onError?: TrafficWarErrorHandler;
|
|
62
63
|
}
|
|
63
64
|
interface TrafficWarOptions extends TrafficWarQueueOptions {
|
|
@@ -65,23 +66,8 @@ interface TrafficWarOptions extends TrafficWarQueueOptions {
|
|
|
65
66
|
baseUrl?: string | URL;
|
|
66
67
|
/** Print batch lifecycle diagnostics without event payloads or credentials. */
|
|
67
68
|
debug?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* At startup, statically scan application source for `capture()` calls and
|
|
70
|
-
* print each pair whose `event` and `label` resolve to fixed strings.
|
|
71
|
-
* Calls with an unresolved or missing value are omitted. Defaults to `false`.
|
|
72
|
-
*/
|
|
69
|
+
/** Log successfully registered new event/label pairs. Defaults to false. */
|
|
73
70
|
verbose?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Require a complete startup catalog of fixed event/label pairs. Unresolved,
|
|
76
|
-
* empty, or failed scans disable capture; unlisted runtime pairs are rejected.
|
|
77
|
-
* Defaults to true. Set false to opt out. Does not depend on verbose logging.
|
|
78
|
-
*/
|
|
79
|
-
strictCatalog?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Directory scanned when `verbose` or `strictCatalog` is true. Defaults to
|
|
82
|
-
* the process working directory.
|
|
83
|
-
*/
|
|
84
|
-
catalogRoot?: string;
|
|
85
71
|
timeoutMs?: number;
|
|
86
72
|
maxRetries?: number;
|
|
87
73
|
compression?: CompressionMode;
|
|
@@ -112,7 +98,6 @@ declare class TrafficWar {
|
|
|
112
98
|
readonly baseUrl: string;
|
|
113
99
|
readonly debug: boolean;
|
|
114
100
|
readonly verbose: boolean;
|
|
115
|
-
readonly strictCatalog: boolean;
|
|
116
101
|
readonly timeoutMs: number;
|
|
117
102
|
readonly maxRetries: number;
|
|
118
103
|
readonly compression: CompressionMode;
|
|
@@ -120,8 +105,6 @@ declare class TrafficWar {
|
|
|
120
105
|
readonly flushIntervalMs: number;
|
|
121
106
|
readonly maxQueueSize: number;
|
|
122
107
|
constructor(options: TrafficWarOptions);
|
|
123
|
-
/** False when strictCatalog disabled capture at startup; recreate after fixing source. */
|
|
124
|
-
get captureEnabled(): boolean;
|
|
125
108
|
capture(eventOrEvents: TrafficWarEvent | readonly TrafficWarEvent[]): void;
|
|
126
109
|
/**
|
|
127
110
|
* @deprecated Pass the array directly to capture().
|
package/dist/index.d.ts
CHANGED
|
@@ -20,12 +20,13 @@ type S3Source = OpenString<KnownS3Provider | `${string}.${KnownS3Provider}`>;
|
|
|
20
20
|
interface TrafficWarEvent {
|
|
21
21
|
event: EventCategory;
|
|
22
22
|
event_id?: string;
|
|
23
|
-
/** RFC3339 string, epoch milliseconds, or Date.
|
|
24
|
-
timestamp
|
|
25
|
-
|
|
23
|
+
/** Actual span start: RFC3339 string, integer epoch milliseconds, or Date. */
|
|
24
|
+
timestamp: string | number | Date;
|
|
25
|
+
/** Measured duration; finite and nonnegative. */
|
|
26
|
+
latency_ms: number;
|
|
26
27
|
properties?: JsonValue;
|
|
27
28
|
user_agent?: string;
|
|
28
|
-
label
|
|
29
|
+
label: string;
|
|
29
30
|
ip?: string;
|
|
30
31
|
/**
|
|
31
32
|
* Stable emitter or dependency alias. External-service stations are keyed by
|
|
@@ -33,20 +34,20 @@ interface TrafficWarEvent {
|
|
|
33
34
|
* `<bucket>.<provider>` such as `assets.ovh-s3` when separate bucket stations
|
|
34
35
|
* are useful. Put the concrete action in `operation_type`.
|
|
35
36
|
*/
|
|
36
|
-
source
|
|
37
|
+
source: string;
|
|
37
38
|
country?: string;
|
|
38
39
|
city?: string;
|
|
39
40
|
trace_id?: string;
|
|
40
41
|
distinct_id?: string;
|
|
41
42
|
path?: string;
|
|
42
|
-
/** RFC HTTP token, normalized to uppercase after trimming. */
|
|
43
|
+
/** Required for HTTP events. RFC HTTP token, normalized to uppercase after trimming. */
|
|
43
44
|
http_method?: string;
|
|
44
45
|
error?: string;
|
|
45
46
|
exception?: string;
|
|
46
47
|
error_code?: string;
|
|
47
|
-
span_kind
|
|
48
|
+
span_kind: SpanKind;
|
|
48
49
|
/** Concrete work performed, such as `route.handler` or `google.routes.compute`. */
|
|
49
|
-
operation_type
|
|
50
|
+
operation_type: OperationType;
|
|
50
51
|
status_code?: number;
|
|
51
52
|
}
|
|
52
53
|
type CompressionMode = "auto" | "gzip" | "none";
|
|
@@ -57,7 +58,7 @@ interface TrafficWarQueueOptions {
|
|
|
57
58
|
flushIntervalMs?: number;
|
|
58
59
|
/** Maximum number of unacknowledged events held by this client. */
|
|
59
60
|
maxQueueSize?: number;
|
|
60
|
-
/** Receives
|
|
61
|
+
/** Receives automatic event-delivery and catalog-registration errors. */
|
|
61
62
|
onError?: TrafficWarErrorHandler;
|
|
62
63
|
}
|
|
63
64
|
interface TrafficWarOptions extends TrafficWarQueueOptions {
|
|
@@ -65,23 +66,8 @@ interface TrafficWarOptions extends TrafficWarQueueOptions {
|
|
|
65
66
|
baseUrl?: string | URL;
|
|
66
67
|
/** Print batch lifecycle diagnostics without event payloads or credentials. */
|
|
67
68
|
debug?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* At startup, statically scan application source for `capture()` calls and
|
|
70
|
-
* print each pair whose `event` and `label` resolve to fixed strings.
|
|
71
|
-
* Calls with an unresolved or missing value are omitted. Defaults to `false`.
|
|
72
|
-
*/
|
|
69
|
+
/** Log successfully registered new event/label pairs. Defaults to false. */
|
|
73
70
|
verbose?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Require a complete startup catalog of fixed event/label pairs. Unresolved,
|
|
76
|
-
* empty, or failed scans disable capture; unlisted runtime pairs are rejected.
|
|
77
|
-
* Defaults to true. Set false to opt out. Does not depend on verbose logging.
|
|
78
|
-
*/
|
|
79
|
-
strictCatalog?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Directory scanned when `verbose` or `strictCatalog` is true. Defaults to
|
|
82
|
-
* the process working directory.
|
|
83
|
-
*/
|
|
84
|
-
catalogRoot?: string;
|
|
85
71
|
timeoutMs?: number;
|
|
86
72
|
maxRetries?: number;
|
|
87
73
|
compression?: CompressionMode;
|
|
@@ -112,7 +98,6 @@ declare class TrafficWar {
|
|
|
112
98
|
readonly baseUrl: string;
|
|
113
99
|
readonly debug: boolean;
|
|
114
100
|
readonly verbose: boolean;
|
|
115
|
-
readonly strictCatalog: boolean;
|
|
116
101
|
readonly timeoutMs: number;
|
|
117
102
|
readonly maxRetries: number;
|
|
118
103
|
readonly compression: CompressionMode;
|
|
@@ -120,8 +105,6 @@ declare class TrafficWar {
|
|
|
120
105
|
readonly flushIntervalMs: number;
|
|
121
106
|
readonly maxQueueSize: number;
|
|
122
107
|
constructor(options: TrafficWarOptions);
|
|
123
|
-
/** False when strictCatalog disabled capture at startup; recreate after fixing source. */
|
|
124
|
-
get captureEnabled(): boolean;
|
|
125
108
|
capture(eventOrEvents: TrafficWarEvent | readonly TrafficWarEvent[]): void;
|
|
126
109
|
/**
|
|
127
110
|
* @deprecated Pass the array directly to capture().
|