sobey-monitor-sdk 1.1.10 → 1.1.11
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/dist/index.cjs.js +12 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +12 -0
- package/dist/index.umd.js.map +1 -1
- package/dist/reporter/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -420,10 +420,12 @@
|
|
|
420
420
|
}
|
|
421
421
|
/**
|
|
422
422
|
* 发送早期缓存的数据(根据最新配置过滤)
|
|
423
|
+
* 所有数据会先累积到 sender 的缓冲区,最后统一发送一次
|
|
423
424
|
*/
|
|
424
425
|
flushEarlyBuffer() {
|
|
425
426
|
const cfg = config.get();
|
|
426
427
|
let skippedCount = 0;
|
|
428
|
+
let processedCount = 0;
|
|
427
429
|
// 全局开关检查:如果 enabled 为 false,清空缓存不上报
|
|
428
430
|
if (cfg.enabled === false) {
|
|
429
431
|
const totalCount = this.earlyBuffer.length;
|
|
@@ -464,6 +466,7 @@
|
|
|
464
466
|
continue;
|
|
465
467
|
}
|
|
466
468
|
this.reportError(item.data);
|
|
469
|
+
processedCount++;
|
|
467
470
|
break;
|
|
468
471
|
case 'performance':
|
|
469
472
|
// 检查性能监控是否启用
|
|
@@ -472,6 +475,7 @@
|
|
|
472
475
|
continue;
|
|
473
476
|
}
|
|
474
477
|
this.reportPerformance(item.data);
|
|
478
|
+
processedCount++;
|
|
475
479
|
break;
|
|
476
480
|
case 'behavior':
|
|
477
481
|
// 检查行为监控是否启用
|
|
@@ -490,9 +494,17 @@
|
|
|
490
494
|
continue;
|
|
491
495
|
}
|
|
492
496
|
this.reportBehavior(item.data);
|
|
497
|
+
processedCount++;
|
|
493
498
|
break;
|
|
494
499
|
}
|
|
495
500
|
}
|
|
501
|
+
// 所有早期数据已添加到 sender 缓冲区,立即统一发送
|
|
502
|
+
if (processedCount > 0) {
|
|
503
|
+
sender.flush();
|
|
504
|
+
if (cfg.debug) {
|
|
505
|
+
console.log(`[Monitor] Flushed ${processedCount} early buffered items in single batch`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
496
508
|
if (skippedCount > 0 && cfg.debug) {
|
|
497
509
|
console.log(`[Monitor] Filtered out ${skippedCount} early buffered items based on config`);
|
|
498
510
|
}
|