@warpmetrics/warp 0.0.12 → 0.0.13
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/package.json +1 -1
- package/src/core/transport.js +14 -7
- package/src/trace/call.js +5 -2
package/package.json
CHANGED
package/src/core/transport.js
CHANGED
|
@@ -139,13 +139,20 @@ export async function flush() {
|
|
|
139
139
|
if (config.debug) {
|
|
140
140
|
console.error('[warpmetrics] Flush failed:', err.message);
|
|
141
141
|
}
|
|
142
|
-
//
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
// Only re-queue if it's not a rate limit error (429)
|
|
143
|
+
// Rate limit errors should wait for the next flush interval
|
|
144
|
+
const isRateLimit = err.message?.includes('429') || err.message?.includes('RATE_LIMIT');
|
|
145
|
+
if (!isRateLimit) {
|
|
146
|
+
// Re-queue so nothing is lost.
|
|
147
|
+
queue.runs.unshift(...batch.runs);
|
|
148
|
+
queue.groups.unshift(...batch.groups);
|
|
149
|
+
queue.calls.unshift(...batch.calls);
|
|
150
|
+
queue.links.unshift(...batch.links);
|
|
151
|
+
queue.outcomes.unshift(...batch.outcomes);
|
|
152
|
+
queue.acts.unshift(...batch.acts);
|
|
153
|
+
} else if (config.debug) {
|
|
154
|
+
console.warn('[warpmetrics] Rate limited - discarding batch to avoid retry loop. Will retry on next flush.');
|
|
155
|
+
}
|
|
149
156
|
}
|
|
150
157
|
}
|
|
151
158
|
|
package/src/trace/call.js
CHANGED
|
@@ -24,7 +24,10 @@ export function call(target, response, opts) {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// Auto-extract _warpResponse if present (error case)
|
|
28
|
+
const actualResponse = response?._warpResponse || response;
|
|
29
|
+
|
|
30
|
+
const entry = responseRegistry.get(actualResponse);
|
|
28
31
|
if (!entry) {
|
|
29
32
|
if (getConfig().debug) console.warn('[warpmetrics] call() — response not tracked. Was it from a warp()-ed client?');
|
|
30
33
|
return;
|
|
@@ -37,5 +40,5 @@ export function call(target, response, opts) {
|
|
|
37
40
|
logLink({ parentId: targetId, childId: id, type: 'call' });
|
|
38
41
|
parentData.calls.push(id);
|
|
39
42
|
|
|
40
|
-
responseRegistry.delete(
|
|
43
|
+
responseRegistry.delete(actualResponse);
|
|
41
44
|
}
|