@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.js CHANGED
@@ -16226,7 +16226,7 @@ function initializeSignOzTracing(config) {
16226
16226
  batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
16227
16227
  maxQueueSize: 100,
16228
16228
  scheduledDelayMillis: 2000, // Kirim lebih cepat (2 detik)
16229
- exportTimeoutMillis: 5000, // Timeout lebih pendek (5 detik)
16229
+ exportTimeoutMillis: 3000, // Timeout lebih pendek (3 detik) untuk fail fast
16230
16230
  maxExportBatchSize: 20 // Batch lebih kecil untuk menghindari timeout
16231
16231
  },
16232
16232
  allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
@@ -16261,47 +16261,63 @@ function initializeSignOzTracing(config) {
16261
16261
  const exporter = new OTLPTraceExporter({
16262
16262
  url: effectiveConfig.url,
16263
16263
  headers: effectiveConfig.headers,
16264
- timeoutMillis: 5000 // Timeout lebih pendek (5 detik) untuk fail fast
16264
+ timeoutMillis: 3000 // Timeout lebih pendek (3 detik) untuk fail fast
16265
16265
  });
16266
- // Wrap exporter to suppress timeout errors completely
16266
+ // Wrap exporter to suppress timeout errors completely and prevent them from reaching Zone.js
16267
16267
  const originalExport = exporter.export.bind(exporter);
16268
+ let timeoutWarningShown = false;
16268
16269
  exporter.export = function (spans, resultCallback) {
16269
- // Wrap in try-catch to prevent any errors from propagating
16270
+ let callbackInvoked = false;
16271
+ const safeCallback = (result) => {
16272
+ if (callbackInvoked)
16273
+ return;
16274
+ callbackInvoked = true;
16275
+ try {
16276
+ resultCallback(result);
16277
+ }
16278
+ catch (e) {
16279
+ // Suppress any errors from the callback itself
16280
+ }
16281
+ };
16282
+ // Set a timeout to force success callback BEFORE the actual timeout occurs
16283
+ const timeoutId = setTimeout(() => {
16284
+ if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
16285
+ console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
16286
+ timeoutWarningShown = true;
16287
+ }
16288
+ // Force success callback to prevent error propagation
16289
+ safeCallback({ code: 0 });
16290
+ }, 2500); // Trigger before the 3s exporter timeout
16270
16291
  try {
16271
- // Set a timeout to force success callback if export takes too long
16272
- const timeoutId = setTimeout(() => {
16273
- // Force success callback to prevent error propagation
16274
- resultCallback({ code: 0 });
16275
- }, 6000); // Slightly longer than exporter timeout
16276
16292
  originalExport(spans, (result) => {
16277
16293
  clearTimeout(timeoutId);
16278
- // Suppress ALL errors to prevent console noise and Zone.js catching them
16294
+ // Always treat as success to prevent any error propagation
16279
16295
  if (result.error) {
16280
16296
  const errorMessage = String(result.error);
16281
- if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
16282
- if (effectiveConfig.enableConsoleLog) {
16297
+ if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
16298
+ if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
16283
16299
  console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
16284
16300
  }
16285
- // Call callback with success to prevent error propagation
16286
- resultCallback({ code: 0 });
16287
- return;
16288
- }
16289
- // For other errors, also suppress but log if console logging is enabled
16290
- if (effectiveConfig.enableConsoleLog) {
16291
- console.warn('[SignOz] Span export error (suppressed):', errorMessage);
16301
+ else {
16302
+ console.warn('[SignOz] Span export error (suppressed):', errorMessage);
16303
+ }
16304
+ timeoutWarningShown = true;
16292
16305
  }
16293
- resultCallback({ code: 0 });
16306
+ // Always return success to prevent error propagation
16307
+ safeCallback({ code: 0 });
16294
16308
  return;
16295
16309
  }
16296
- resultCallback(result);
16310
+ safeCallback(result);
16297
16311
  });
16298
16312
  }
16299
16313
  catch (error) {
16314
+ clearTimeout(timeoutId);
16300
16315
  // Catch any synchronous errors and suppress them
16301
- if (effectiveConfig.enableConsoleLog) {
16316
+ if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
16302
16317
  console.warn('[SignOz] Span export exception (suppressed):', error);
16318
+ timeoutWarningShown = true;
16303
16319
  }
16304
- resultCallback({ code: 0 });
16320
+ safeCallback({ code: 0 });
16305
16321
  }
16306
16322
  };
16307
16323
  // Set up the span processor with configuration