@tracelog/lib 2.0.1-rc.69.3 → 2.0.1

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.
@@ -639,7 +639,7 @@ var init_performance_constants = __esm({
639
639
  var version;
640
640
  var init_package = __esm({
641
641
  "package.json"() {
642
- version = "2.0.1";
642
+ version = "2.0.0";
643
643
  }
644
644
  });
645
645
 
@@ -3316,7 +3316,7 @@ var init_event_manager = __esm({
3316
3316
  this.emitEventsQueue(body);
3317
3317
  } else {
3318
3318
  this.clearSendInterval();
3319
- log("warn", "Sync flush complete failure, events kept in queue for retry", {
3319
+ log("warn", "Sync flush failed for all integrations, events remain in queue for next flush", {
3320
3320
  data: { eventCount: eventIds.length }
3321
3321
  });
3322
3322
  }
@@ -3336,9 +3336,21 @@ var init_event_manager = __esm({
3336
3336
  this.removeProcessedEvents(eventIds);
3337
3337
  this.clearSendInterval();
3338
3338
  this.emitEventsQueue(body);
3339
+ const failedCount = results.filter((result) => !this.isSuccessfulResult(result)).length;
3340
+ if (failedCount > 0) {
3341
+ log(
3342
+ "warn",
3343
+ "Async flush completed with partial success, events removed from queue and persisted per failed integration",
3344
+ {
3345
+ data: { eventCount: eventsToSend.length, succeededCount: results.length - failedCount, failedCount }
3346
+ }
3347
+ );
3348
+ }
3339
3349
  } else {
3340
- log("warn", "Async flush complete failure, events kept in queue for retry", {
3341
- data: { eventCount: eventsToSend.length }
3350
+ this.removeProcessedEvents(eventIds);
3351
+ this.clearSendInterval();
3352
+ log("error", "Async flush failed for all integrations, events persisted per-integration for recovery", {
3353
+ data: { eventCount: eventsToSend.length, integrations: this.dataSenders.length }
3342
3354
  });
3343
3355
  }
3344
3356
  return anySucceeded;
@@ -3365,24 +3377,20 @@ var init_event_manager = __esm({
3365
3377
  })
3366
3378
  );
3367
3379
  const results = await Promise.allSettled(sendPromises);
3380
+ this.removeProcessedEvents(eventIds);
3368
3381
  const anySucceeded = results.some((result) => this.isSuccessfulResult(result));
3369
3382
  if (anySucceeded) {
3370
- this.removeProcessedEvents(eventIds);
3371
3383
  this.emitEventsQueue(body);
3372
- const failedCount = results.filter((result) => !this.isSuccessfulResult(result)).length;
3373
- if (failedCount > 0) {
3374
- log("warn", "Periodic send completed with some failures, removed from queue and persisted per-integration", {
3375
- data: { eventCount: eventsToSend.length, failedCount }
3376
- });
3377
- }
3378
- } else {
3379
- log("warn", "Periodic send complete failure, events kept in queue for retry", {
3380
- data: { eventCount: eventsToSend.length }
3381
- });
3382
3384
  }
3383
3385
  if (this.eventsQueue.length === 0) {
3384
3386
  this.clearSendInterval();
3385
3387
  }
3388
+ const failedCount = results.filter((result) => !this.isSuccessfulResult(result)).length;
3389
+ if (failedCount > 0) {
3390
+ log("warn", "Events send completed with some failures, removed from queue and persisted per-integration", {
3391
+ data: { eventCount: eventsToSend.length, failedCount }
3392
+ });
3393
+ }
3386
3394
  }
3387
3395
  buildEventsPayload() {
3388
3396
  const eventMap = /* @__PURE__ */ new Map();