@logspace/sdk 1.1.6 → 1.1.7
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/logspace.esm.js +22 -2
- package/logspace.esm.js.map +1 -1
- package/logspace.iife.js +1 -1
- package/logspace.iife.js.map +1 -1
- package/logspace.umd.js +1 -1
- package/logspace.umd.js.map +1 -1
- package/package.json +1 -1
package/logspace.esm.js
CHANGED
|
@@ -14524,6 +14524,10 @@ let rateLimiter = { count: 0, windowStart: 0 };
|
|
|
14524
14524
|
let deduplication = { lastLogHash: null, lastLogCount: 0 };
|
|
14525
14525
|
let currentSize = 0;
|
|
14526
14526
|
let rrwebSize = 0;
|
|
14527
|
+
let lastRateLimitWarningTime = 0;
|
|
14528
|
+
const RATE_LIMIT_WARNING_THROTTLE_MS = 1e3;
|
|
14529
|
+
let rrwebRateLimiter = { count: 0, windowStart: 0 };
|
|
14530
|
+
const RRWEB_RATE_LIMIT = 500;
|
|
14527
14531
|
let idleTimer = null;
|
|
14528
14532
|
let durationTimer = null;
|
|
14529
14533
|
let checkpointTimer = null;
|
|
@@ -14751,7 +14755,11 @@ function checkRateLimit() {
|
|
|
14751
14755
|
rateLimiter.count++;
|
|
14752
14756
|
if (rateLimiter.count > config.limits.rateLimit) {
|
|
14753
14757
|
if (config.debug) {
|
|
14754
|
-
|
|
14758
|
+
const now2 = Date.now();
|
|
14759
|
+
if (now2 - lastRateLimitWarningTime >= RATE_LIMIT_WARNING_THROTTLE_MS) {
|
|
14760
|
+
lastRateLimitWarningTime = now2;
|
|
14761
|
+
console.warn("[LogSpace] Rate limit exceeded, dropping log");
|
|
14762
|
+
}
|
|
14755
14763
|
}
|
|
14756
14764
|
return false;
|
|
14757
14765
|
}
|
|
@@ -15952,6 +15960,8 @@ const LogSpace = {
|
|
|
15952
15960
|
currentSize = 0;
|
|
15953
15961
|
rrwebSize = 0;
|
|
15954
15962
|
rateLimiter = { count: 0, windowStart: 0 };
|
|
15963
|
+
rrwebRateLimiter = { count: 0, windowStart: 0 };
|
|
15964
|
+
lastRateLimitWarningTime = 0;
|
|
15955
15965
|
deduplication = { lastLogHash: null, lastLogCount: 0 };
|
|
15956
15966
|
endReason = "manual";
|
|
15957
15967
|
let sessionId;
|
|
@@ -16019,7 +16029,17 @@ const LogSpace = {
|
|
|
16019
16029
|
},
|
|
16020
16030
|
(event) => {
|
|
16021
16031
|
if (!session || session.status !== "recording") return;
|
|
16022
|
-
const
|
|
16032
|
+
const now = Date.now();
|
|
16033
|
+
if (now - rrwebRateLimiter.windowStart > 1e3) {
|
|
16034
|
+
rrwebRateLimiter.windowStart = now;
|
|
16035
|
+
rrwebRateLimiter.count = 1;
|
|
16036
|
+
} else {
|
|
16037
|
+
rrwebRateLimiter.count++;
|
|
16038
|
+
if (rrwebRateLimiter.count > RRWEB_RATE_LIMIT) {
|
|
16039
|
+
return;
|
|
16040
|
+
}
|
|
16041
|
+
}
|
|
16042
|
+
const eventSize = event.type === 2 ? 5e4 : 500;
|
|
16023
16043
|
rrwebSize += eventSize;
|
|
16024
16044
|
const totalSize = currentSize + rrwebSize;
|
|
16025
16045
|
if (config && totalSize >= config.limits.maxSize) {
|