wardx 0.9.0 → 0.9.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 +2 -0
- package/package.json +2 -2
- package/src/WardxNode.js +12 -2
- package/src/compression/gzip.js +3 -4
- package/src/transport/HttpTransport.js +4 -2
package/README.md
CHANGED
|
@@ -52,6 +52,8 @@ To receive frames, run an ingest server. Install `@wardx/server` and start it wi
|
|
|
52
52
|
- A measure call does not send network data.
|
|
53
53
|
- A measure call does not wait for a Promise.
|
|
54
54
|
- Delivery is at-most-once. If a sync fails, the SDK discards the batch.
|
|
55
|
+
- Pending physical frames are capped by `maxPendingFrames` (default: 32). On overflow, the oldest frames are discarded and counted in `wardx.internal.frames_failed`. This bounds the pending queue even while an HTTP request stalls; it is not a cap on total SDK memory.
|
|
56
|
+
- `httpTimeoutMs` bounds the entire HTTP request, including connection establishment and response reading.
|
|
55
57
|
- Physical frames are serialized, split to `maxFrameBytes`, and assigned consecutive sequence numbers. An individually oversized row is counted in `wardx.internal.frame_rows_dropped`.
|
|
56
58
|
- The application has priority over telemetry.
|
|
57
59
|
- Remote Config is always read from local memory.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wardx",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Node.js SDK for Wardx telemetry, Remote Config, and experiments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wardx",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wardx/core": "0.9.
|
|
40
|
+
"@wardx/core": "0.9.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/WardxNode.js
CHANGED
|
@@ -50,6 +50,7 @@ export class WardxNode {
|
|
|
50
50
|
this._stopped = false;
|
|
51
51
|
this._shutdownPromise = null;
|
|
52
52
|
this._syncChain = Promise.resolve();
|
|
53
|
+
this._queuedSync = null;
|
|
53
54
|
this._instanceId = ulid();
|
|
54
55
|
this._sessionId = ulid();
|
|
55
56
|
this._aggregateTimer = setInterval(() => {
|
|
@@ -127,7 +128,16 @@ export class WardxNode {
|
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
_enqueueSync(flags) {
|
|
130
|
-
this.
|
|
131
|
+
if (this._queuedSync && !this._queuedSync.bootstrap) {
|
|
132
|
+
this._queuedSync.flush ||= flags.flush;
|
|
133
|
+
return this._syncChain;
|
|
134
|
+
}
|
|
135
|
+
this._queuedSync = flags;
|
|
136
|
+
const run = () => {
|
|
137
|
+
if (this._queuedSync === flags) this._queuedSync = null;
|
|
138
|
+
return this._syncOnce(flags);
|
|
139
|
+
};
|
|
140
|
+
this._syncChain = this._syncChain.then(run, run);
|
|
131
141
|
return this._syncChain;
|
|
132
142
|
}
|
|
133
143
|
|
|
@@ -168,7 +178,7 @@ export class WardxNode {
|
|
|
168
178
|
frames
|
|
169
179
|
};
|
|
170
180
|
const json = JSON.stringify(envelope);
|
|
171
|
-
const compressed = gzipBuffer(json);
|
|
181
|
+
const compressed = await gzipBuffer(json);
|
|
172
182
|
const bytesUncompressed = Buffer.byteLength(json);
|
|
173
183
|
const bytesCompressed = compressed.length;
|
|
174
184
|
this._core.internal.bytesUncompressed += bytesUncompressed;
|
package/src/compression/gzip.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promisify } from 'node:util';
|
|
2
|
+
import { gzip, gunzipSync } from 'node:zlib';
|
|
2
3
|
|
|
3
|
-
export
|
|
4
|
-
return gzipSync(input);
|
|
5
|
-
}
|
|
4
|
+
export const gzipBuffer = promisify(gzip);
|
|
6
5
|
|
|
7
6
|
export function gunzipBuffer(input) {
|
|
8
7
|
return gunzipSync(input);
|
|
@@ -35,6 +35,7 @@ export function createHttpTransport({ endpoint, projectKey, httpTimeoutMs }) {
|
|
|
35
35
|
},
|
|
36
36
|
(res) => {
|
|
37
37
|
const chunks = [];
|
|
38
|
+
res.on('error', reject);
|
|
38
39
|
res.on('data', (chunk) => chunks.push(chunk));
|
|
39
40
|
res.on('end', () => {
|
|
40
41
|
const buf = Buffer.concat(chunks);
|
|
@@ -55,9 +56,10 @@ export function createHttpTransport({ endpoint, projectKey, httpTimeoutMs }) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
|
-
|
|
59
|
+
const deadline = setTimeout(() => {
|
|
59
60
|
req.destroy(new Error('wardx sync timed out'));
|
|
60
|
-
});
|
|
61
|
+
}, httpTimeoutMs);
|
|
62
|
+
req.once('close', () => clearTimeout(deadline));
|
|
61
63
|
req.on('error', reject);
|
|
62
64
|
req.write(gzippedBody);
|
|
63
65
|
req.end();
|