@scalebun/react-native 1.2.1 → 1.2.2-beta.0

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.
@@ -12548,12 +12548,23 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
12548
12548
  this._triggerNativeFlush();
12549
12549
  }
12550
12550
  queuePerformanceMetric(data) {
12551
- if (this.destroyed || !this.config.clientKey) return;
12551
+ if (this.destroyed || !this.config.clientKey) {
12552
+ logger.warn("[perf.queue] dropped \u2014 no clientKey or adapter destroyed", {
12553
+ type: data.type,
12554
+ destroyed: this.destroyed,
12555
+ hasClientKey: !!this.config.clientKey
12556
+ });
12557
+ return;
12558
+ }
12552
12559
  this.pendingPerformanceMetrics.push({
12553
12560
  ...data,
12554
12561
  clientId: this._clientId(),
12555
12562
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12556
12563
  });
12564
+ logger.debug("[perf.queue] enqueued performance metric", {
12565
+ type: data.type,
12566
+ pending: this.pendingPerformanceMetrics.length
12567
+ });
12557
12568
  if (this.pendingPerformanceMetrics.length >= 20) {
12558
12569
  this._flushPerformance().catch(() => {
12559
12570
  });
@@ -13120,19 +13131,43 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
13120
13131
  }
13121
13132
  }
13122
13133
  async _flushPerformance() {
13123
- if (this.pendingPerformanceMetrics.length === 0 || !this.currentSessionId || !this.config.clientKey) return;
13134
+ if (this.pendingPerformanceMetrics.length === 0) return;
13135
+ if (!this.currentSessionId || !this.config.clientKey) {
13136
+ logger.debug("[perf.flush] waiting \u2014 not deliverable yet", {
13137
+ pending: this.pendingPerformanceMetrics.length,
13138
+ hasSession: !!this.currentSessionId,
13139
+ hasClientKey: !!this.config.clientKey
13140
+ });
13141
+ return;
13142
+ }
13124
13143
  const batch = this.pendingPerformanceMetrics.splice(0, 50);
13125
13144
  try {
13126
- if (await this._enqueueNative("performance", batch)) return;
13145
+ if (await this._enqueueNative("performance", batch)) {
13146
+ logger.debug("[perf.flush] handed to native outbox", {
13147
+ count: batch.length
13148
+ });
13149
+ return;
13150
+ }
13127
13151
  if (!this._sessionRowReady()) {
13152
+ logger.debug("[perf.flush] session row not ready \u2014 re-buffering", {
13153
+ count: batch.length
13154
+ });
13128
13155
  this.pendingPerformanceMetrics.unshift(...batch);
13129
13156
  return;
13130
13157
  }
13131
13158
  await this._post(ENDPOINTS.INGESTION_PERFORMANCE(this.currentSessionId), {
13132
13159
  metrics: batch
13133
13160
  });
13161
+ logger.info("[perf.flush] POST performance metrics ok", {
13162
+ count: batch.length
13163
+ });
13134
13164
  } catch (err) {
13135
- if (!_BackendSessionAdapter._isPermanentHttpError(err)) this.pendingPerformanceMetrics.unshift(...batch);
13165
+ const permanent = _BackendSessionAdapter._isPermanentHttpError(err);
13166
+ logger.warn("[perf.flush] POST performance metrics failed", {
13167
+ count: batch.length,
13168
+ permanent
13169
+ });
13170
+ if (!permanent) this.pendingPerformanceMetrics.unshift(...batch);
13136
13171
  }
13137
13172
  }
13138
13173
  async _flushLogs() {