@echoteam/signoz-react 1.2.15 → 1.2.16

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.esm.js CHANGED
@@ -16206,7 +16206,7 @@ function initializeSignOzTracing(config) {
16206
16206
  batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
16207
16207
  maxQueueSize: 100,
16208
16208
  scheduledDelayMillis: 2000, // Kirim lebih cepat (2 detik)
16209
- exportTimeoutMillis: 5000, // Timeout lebih pendek (5 detik)
16209
+ exportTimeoutMillis: 3000, // Timeout lebih pendek (3 detik) untuk fail fast
16210
16210
  maxExportBatchSize: 20 // Batch lebih kecil untuk menghindari timeout
16211
16211
  },
16212
16212
  allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
@@ -16241,47 +16241,63 @@ function initializeSignOzTracing(config) {
16241
16241
  const exporter = new OTLPTraceExporter({
16242
16242
  url: effectiveConfig.url,
16243
16243
  headers: effectiveConfig.headers,
16244
- timeoutMillis: 5000 // Timeout lebih pendek (5 detik) untuk fail fast
16244
+ timeoutMillis: 3000 // Timeout lebih pendek (3 detik) untuk fail fast
16245
16245
  });
16246
- // Wrap exporter to suppress timeout errors completely
16246
+ // Wrap exporter to suppress timeout errors completely and prevent them from reaching Zone.js
16247
16247
  const originalExport = exporter.export.bind(exporter);
16248
+ let timeoutWarningShown = false;
16248
16249
  exporter.export = function (spans, resultCallback) {
16249
- // Wrap in try-catch to prevent any errors from propagating
16250
+ let callbackInvoked = false;
16251
+ const safeCallback = (result) => {
16252
+ if (callbackInvoked)
16253
+ return;
16254
+ callbackInvoked = true;
16255
+ try {
16256
+ resultCallback(result);
16257
+ }
16258
+ catch (e) {
16259
+ // Suppress any errors from the callback itself
16260
+ }
16261
+ };
16262
+ // Set a timeout to force success callback BEFORE the actual timeout occurs
16263
+ const timeoutId = setTimeout(() => {
16264
+ if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
16265
+ console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
16266
+ timeoutWarningShown = true;
16267
+ }
16268
+ // Force success callback to prevent error propagation
16269
+ safeCallback({ code: 0 });
16270
+ }, 2500); // Trigger before the 3s exporter timeout
16250
16271
  try {
16251
- // Set a timeout to force success callback if export takes too long
16252
- const timeoutId = setTimeout(() => {
16253
- // Force success callback to prevent error propagation
16254
- resultCallback({ code: 0 });
16255
- }, 6000); // Slightly longer than exporter timeout
16256
16272
  originalExport(spans, (result) => {
16257
16273
  clearTimeout(timeoutId);
16258
- // Suppress ALL errors to prevent console noise and Zone.js catching them
16274
+ // Always treat as success to prevent any error propagation
16259
16275
  if (result.error) {
16260
16276
  const errorMessage = String(result.error);
16261
- if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
16262
- if (effectiveConfig.enableConsoleLog) {
16277
+ if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
16278
+ if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
16263
16279
  console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
16264
16280
  }
16265
- // Call callback with success to prevent error propagation
16266
- resultCallback({ code: 0 });
16267
- return;
16268
- }
16269
- // For other errors, also suppress but log if console logging is enabled
16270
- if (effectiveConfig.enableConsoleLog) {
16271
- console.warn('[SignOz] Span export error (suppressed):', errorMessage);
16281
+ else {
16282
+ console.warn('[SignOz] Span export error (suppressed):', errorMessage);
16283
+ }
16284
+ timeoutWarningShown = true;
16272
16285
  }
16273
- resultCallback({ code: 0 });
16286
+ // Always return success to prevent error propagation
16287
+ safeCallback({ code: 0 });
16274
16288
  return;
16275
16289
  }
16276
- resultCallback(result);
16290
+ safeCallback(result);
16277
16291
  });
16278
16292
  }
16279
16293
  catch (error) {
16294
+ clearTimeout(timeoutId);
16280
16295
  // Catch any synchronous errors and suppress them
16281
- if (effectiveConfig.enableConsoleLog) {
16296
+ if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
16282
16297
  console.warn('[SignOz] Span export exception (suppressed):', error);
16298
+ timeoutWarningShown = true;
16283
16299
  }
16284
- resultCallback({ code: 0 });
16300
+ safeCallback({ code: 0 });
16285
16301
  }
16286
16302
  };
16287
16303
  // Set up the span processor with configuration