@echoteam/signoz-react 1.2.11 → 1.2.13

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
@@ -15571,7 +15571,22 @@ function addXHRLogging(config) {
15571
15571
  function addErrorTracking(enableConsoleLog = false) {
15572
15572
  // Track unhandled errors
15573
15573
  window.addEventListener('error', (event) => {
15574
- var _a;
15574
+ var _a, _b;
15575
+ // Skip SignOz internal timeout errors
15576
+ const errorMessage = event.message || '';
15577
+ const errorStack = ((_a = event.error) === null || _a === void 0 ? void 0 : _a.stack) || '';
15578
+ const isSignOzTimeout = (errorMessage.includes('Timeout') &&
15579
+ (errorMessage.includes('BatchSpanProcessor') ||
15580
+ errorStack.includes('BatchSpanProcessor') ||
15581
+ errorStack.includes('zone.js') ||
15582
+ errorStack.includes('SignOz')));
15583
+ if (isSignOzTimeout) {
15584
+ if (enableConsoleLog) {
15585
+ console.warn('[SignOz] Span export timeout detected (safe to ignore - not tracking this error)');
15586
+ }
15587
+ event.preventDefault(); // Prevent the error from propagating
15588
+ return;
15589
+ }
15575
15590
  const tracer = trace.getTracer('error-tracker');
15576
15591
  const span = tracer.startSpan('Unhandled Error');
15577
15592
  span.setAttribute('error.type', 'unhandled');
@@ -15596,7 +15611,7 @@ function addErrorTracking(enableConsoleLog = false) {
15596
15611
  filename: event.filename,
15597
15612
  lineno: event.lineno,
15598
15613
  colno: event.colno,
15599
- stack: (_a = event.error) === null || _a === void 0 ? void 0 : _a.stack,
15614
+ stack: (_b = event.error) === null || _b === void 0 ? void 0 : _b.stack,
15600
15615
  page: window.location.pathname
15601
15616
  });
15602
15617
  }
@@ -15686,6 +15701,15 @@ function addErrorTracking(enableConsoleLog = false) {
15686
15701
  console.error = function (...args) {
15687
15702
  // Check if this is a React error
15688
15703
  const errorMessage = args.map(arg => String(arg)).join(' ');
15704
+ // Skip SignOz internal errors
15705
+ const isSignOzError = (errorMessage.includes('Timeout') &&
15706
+ (errorMessage.includes('BatchSpanProcessor') ||
15707
+ errorMessage.includes('zone.js') ||
15708
+ errorMessage.includes('SignOz')));
15709
+ if (isSignOzError) {
15710
+ // Just call original console.error without tracking
15711
+ return originalConsoleError.apply(console, args);
15712
+ }
15689
15713
  if (errorMessage.includes('React') || errorMessage.includes('TypeError') || errorMessage.includes('Uncaught')) {
15690
15714
  const tracer = trace.getTracer('error-tracker');
15691
15715
  const span = tracer.startSpan('Console Error');
@@ -16030,7 +16054,7 @@ function initializeSignOzTracing(config) {
16030
16054
  batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
16031
16055
  maxQueueSize: 100,
16032
16056
  scheduledDelayMillis: 5000,
16033
- exportTimeoutMillis: 60000, // Increased to 60 seconds
16057
+ exportTimeoutMillis: 30000, // Reduced to 30 seconds to fail faster
16034
16058
  maxExportBatchSize: 50 // Smaller batches to avoid timeouts
16035
16059
  },
16036
16060
  allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
@@ -16059,12 +16083,31 @@ function initializeSignOzTracing(config) {
16059
16083
  'deployment.environment': effectiveConfig.environment,
16060
16084
  'service.namespace': effectiveConfig.serviceNamespace,
16061
16085
  });
16062
- // Set up the OTLP trace exporter
16086
+ // Set up the OTLP trace exporter with error handling
16063
16087
  const exporter = new OTLPTraceExporter({
16064
16088
  url: effectiveConfig.url,
16065
16089
  headers: effectiveConfig.headers,
16066
- timeoutMillis: 60000 // Set exporter timeout to 60 seconds
16090
+ timeoutMillis: 30000 // Reduced to 30 seconds to fail faster
16067
16091
  });
16092
+ // Wrap exporter to suppress timeout errors
16093
+ const originalExport = exporter.export.bind(exporter);
16094
+ exporter.export = function (spans, resultCallback) {
16095
+ originalExport(spans, (result) => {
16096
+ // Suppress timeout errors to prevent console noise
16097
+ if (result.error) {
16098
+ const errorMessage = String(result.error);
16099
+ if (errorMessage.includes('Timeout') || errorMessage.includes('timeout')) {
16100
+ if (effectiveConfig.enableConsoleLog) {
16101
+ console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
16102
+ }
16103
+ // Call callback with success to prevent error propagation
16104
+ resultCallback({ code: 0 });
16105
+ return;
16106
+ }
16107
+ }
16108
+ resultCallback(result);
16109
+ });
16110
+ };
16068
16111
  // Set up the span processor with configuration
16069
16112
  const processor = new BatchSpanProcessor(exporter, {
16070
16113
  maxQueueSize: effectiveConfig.batchSpanProcessorConfig.maxQueueSize,