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

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.
@@ -10609,6 +10609,7 @@ function getNativePerformanceModule() {
10609
10609
  }
10610
10610
 
10611
10611
  // lib/module/features/performance/collectors/AppLaunchCollector.js
10612
+ init_internalLogger();
10612
10613
  var JS_IMPORT_TIME = Date.now();
10613
10614
  var AppLaunchCollector = class {
10614
10615
  collected = false;
@@ -10626,10 +10627,19 @@ var AppLaunchCollector = class {
10626
10627
  if (this.collected || !this.config.appLaunch) return;
10627
10628
  try {
10628
10629
  const perfModule = getNativePerformanceModule();
10629
- if (!perfModule?.getAppStartInfo) return;
10630
+ if (!perfModule?.getAppStartInfo) {
10631
+ logger.debug("[perf.trace] AppLaunchCollector: native perf module unavailable \u2014 no app_launch");
10632
+ return;
10633
+ }
10630
10634
  const jsReadyTimestamp = Date.now();
10631
10635
  const info = await perfModule.getAppStartInfo();
10632
- if (!info || typeof info.durationMs !== "number") return;
10636
+ if (!info || typeof info.durationMs !== "number") {
10637
+ logger.debug("[perf.trace] AppLaunchCollector: getAppStartInfo returned no usable duration \u2014 no app_launch", {
10638
+ hasInfo: !!info,
10639
+ durationType: typeof info?.durationMs
10640
+ });
10641
+ return;
10642
+ }
10633
10643
  this.collected = true;
10634
10644
  const breakdown = {};
10635
10645
  const phaseLabels = {};
@@ -10674,8 +10684,15 @@ var AppLaunchCollector = class {
10674
10684
  breakdown: hasBreakdown ? breakdown : void 0,
10675
10685
  phaseLabels: hasBreakdown ? phaseLabels : void 0
10676
10686
  };
10687
+ logger.debug("[perf.trace] AppLaunchCollector: app_launch built, invoking handler", {
10688
+ durationMs: event.durationMs,
10689
+ launchType: event.launchType
10690
+ });
10677
10691
  this.onLaunch(event);
10678
- } catch {
10692
+ } catch (e) {
10693
+ logger.debug("[perf.trace] AppLaunchCollector: collect() threw", {
10694
+ message: e?.message
10695
+ });
10679
10696
  }
10680
10697
  }
10681
10698
  };
@@ -11395,6 +11412,7 @@ var PerformanceTransport = class {
11395
11412
 
11396
11413
  // lib/module/features/performance/PerformanceFeature.js
11397
11414
  init_SessionManager();
11415
+ init_internalLogger();
11398
11416
  var PerformanceFeature = class _PerformanceFeature {
11399
11417
  name = "performance";
11400
11418
  active = false;
@@ -11795,7 +11813,14 @@ var PerformanceFeature = class _PerformanceFeature {
11795
11813
  * flushes the backlog in the order the metrics were produced.
11796
11814
  */
11797
11815
  _forwardMetricToBackend(metric) {
11798
- const backendTransport = SessionManager.getExistingInstance()?.getBackendTransport();
11816
+ const sm = SessionManager.getExistingInstance();
11817
+ const backendTransport = sm?.getBackendTransport();
11818
+ logger.debug("[perf.trace] forwardMetricToBackend", {
11819
+ type: metric.type,
11820
+ hasSessionManager: !!sm,
11821
+ hasBackendTransport: !!backendTransport,
11822
+ buffered: this._pendingBackendMetrics.length
11823
+ });
11799
11824
  if (backendTransport) {
11800
11825
  this._drainPendingBackendMetrics(backendTransport);
11801
11826
  backendTransport.queuePerformanceMetric(metric);
@@ -11815,6 +11840,9 @@ var PerformanceFeature = class _PerformanceFeature {
11815
11840
  for (const metric of buffered) {
11816
11841
  backendTransport.queuePerformanceMetric(metric);
11817
11842
  }
11843
+ logger.debug("[perf.trace] drained buffered metrics to backend", {
11844
+ count: buffered.length
11845
+ });
11818
11846
  this._clearBackendDrainTimer();
11819
11847
  this._backendDrainAttempts = 0;
11820
11848
  }
@@ -11827,7 +11855,13 @@ var PerformanceFeature = class _PerformanceFeature {
11827
11855
  */
11828
11856
  _scheduleBackendDrain() {
11829
11857
  if (this._backendDrainTimer) return;
11830
- if (this._backendDrainAttempts >= _PerformanceFeature.BACKEND_DRAIN_MAX_ATTEMPTS) return;
11858
+ if (this._backendDrainAttempts >= _PerformanceFeature.BACKEND_DRAIN_MAX_ATTEMPTS) {
11859
+ logger.warn("[perf.trace] drain gave up \u2014 buffered metrics never reached the backend", {
11860
+ attempts: this._backendDrainAttempts,
11861
+ dropped: this._pendingBackendMetrics.length
11862
+ });
11863
+ return;
11864
+ }
11831
11865
  const delays = _PerformanceFeature.BACKEND_DRAIN_DELAYS;
11832
11866
  const delay = delays[Math.min(this._backendDrainAttempts, delays.length - 1)];
11833
11867
  this._backendDrainAttempts++;
@@ -12561,7 +12595,7 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
12561
12595
  clientId: this._clientId(),
12562
12596
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12563
12597
  });
12564
- logger.debug("[perf.queue] enqueued performance metric", {
12598
+ logger.debug("[perf.trace] queue enqueued performance metric", {
12565
12599
  type: data.type,
12566
12600
  pending: this.pendingPerformanceMetrics.length
12567
12601
  });
@@ -13133,7 +13167,7 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
13133
13167
  async _flushPerformance() {
13134
13168
  if (this.pendingPerformanceMetrics.length === 0) return;
13135
13169
  if (!this.currentSessionId || !this.config.clientKey) {
13136
- logger.debug("[perf.flush] waiting \u2014 not deliverable yet", {
13170
+ logger.debug("[perf.trace] flush waiting \u2014 not deliverable yet", {
13137
13171
  pending: this.pendingPerformanceMetrics.length,
13138
13172
  hasSession: !!this.currentSessionId,
13139
13173
  hasClientKey: !!this.config.clientKey
@@ -13143,13 +13177,13 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
13143
13177
  const batch = this.pendingPerformanceMetrics.splice(0, 50);
13144
13178
  try {
13145
13179
  if (await this._enqueueNative("performance", batch)) {
13146
- logger.debug("[perf.flush] handed to native outbox", {
13180
+ logger.debug("[perf.trace] flush handed to native outbox", {
13147
13181
  count: batch.length
13148
13182
  });
13149
13183
  return;
13150
13184
  }
13151
13185
  if (!this._sessionRowReady()) {
13152
- logger.debug("[perf.flush] session row not ready \u2014 re-buffering", {
13186
+ logger.debug("[perf.trace] flush session row not ready \u2014 re-buffering", {
13153
13187
  count: batch.length
13154
13188
  });
13155
13189
  this.pendingPerformanceMetrics.unshift(...batch);
@@ -13158,7 +13192,7 @@ var BackendSessionAdapter = class _BackendSessionAdapter {
13158
13192
  await this._post(ENDPOINTS.INGESTION_PERFORMANCE(this.currentSessionId), {
13159
13193
  metrics: batch
13160
13194
  });
13161
- logger.info("[perf.flush] POST performance metrics ok", {
13195
+ logger.debug("[perf.trace] flush POST performance metrics ok", {
13162
13196
  count: batch.length
13163
13197
  });
13164
13198
  } catch (err) {