@echoteam/signoz-react 1.2.14 → 1.2.15

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
@@ -16160,7 +16160,8 @@ function initializeSignOzTracing(config) {
16160
16160
  window.onerror = function (message, source, lineno, colno, error) {
16161
16161
  const errorMessage = String(message);
16162
16162
  const errorStack = (error === null || error === void 0 ? void 0 : error.stack) || '';
16163
- // Suppress SignOz timeout errors globally
16163
+ const errorSource = source || '';
16164
+ // Suppress SignOz timeout errors globally - be very aggressive
16164
16165
  const isSignOzTimeout = ((errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) &&
16165
16166
  (errorMessage.includes('BatchSpanProcessor') ||
16166
16167
  errorMessage.includes('OTLP') ||
@@ -16168,10 +16169,12 @@ function initializeSignOzTracing(config) {
16168
16169
  errorStack.includes('BatchSpanProcessor') ||
16169
16170
  errorStack.includes('OTLPTraceExporter') ||
16170
16171
  errorStack.includes('zone.js') ||
16171
- (source === null || source === void 0 ? void 0 : source.includes('zone.js'))));
16172
- const isGenericTimeout = (errorMessage === 'Timeout' ||
16173
- errorMessage === 'timeout' ||
16174
- (errorMessage.includes('Timeout') && errorStack.includes('zone.js')));
16172
+ errorSource.includes('zone.js') ||
16173
+ errorStack.includes('signoz') ||
16174
+ errorSource.includes('signoz')));
16175
+ // Also suppress generic timeout errors from zone.js or bundle.js
16176
+ const isGenericTimeout = ((errorMessage === 'Timeout' || errorMessage === 'timeout') ||
16177
+ (errorMessage.includes('Timeout') && (errorStack.includes('zone.js') || errorSource.includes('bundle.js'))));
16175
16178
  if (isSignOzTimeout || isGenericTimeout) {
16176
16179
  // Suppress completely - don't log, don't propagate
16177
16180
  return true; // Returning true prevents default error handling
@@ -16182,6 +16185,32 @@ function initializeSignOzTracing(config) {
16182
16185
  }
16183
16186
  return false;
16184
16187
  };
16188
+ // Also suppress unhandledrejection for timeout errors
16189
+ const originalUnhandledRejection = window.onunhandledrejection;
16190
+ window.addEventListener('unhandledrejection', function (event) {
16191
+ const reason = String(event.reason);
16192
+ const stack = event.reason instanceof Error ? (event.reason.stack || '') : '';
16193
+ const isSignOzTimeout = ((reason.includes('Timeout') || reason.includes('timeout') || reason.includes('ETIMEDOUT')) &&
16194
+ (reason.includes('BatchSpanProcessor') ||
16195
+ reason.includes('OTLP') ||
16196
+ reason.includes('exporter') ||
16197
+ stack.includes('BatchSpanProcessor') ||
16198
+ stack.includes('OTLPTraceExporter') ||
16199
+ stack.includes('zone.js') ||
16200
+ stack.includes('signoz')));
16201
+ const isGenericTimeout = (reason === 'Timeout' ||
16202
+ reason === 'timeout' ||
16203
+ (reason.includes('Timeout') && stack.includes('zone.js')));
16204
+ if (isSignOzTimeout || isGenericTimeout) {
16205
+ event.preventDefault();
16206
+ event.stopPropagation();
16207
+ event.stopImmediatePropagation();
16208
+ return;
16209
+ }
16210
+ if (originalUnhandledRejection) {
16211
+ originalUnhandledRejection.call(window, event);
16212
+ }
16213
+ }, true);
16185
16214
  // Gabungkan konfigurasi dari parameter, process.env, dan window
16186
16215
  const effectiveConfig = {
16187
16216
  serviceName: (config === null || config === void 0 ? void 0 : config.serviceName) || getConfigValue('REACT_APP_SIGNOZ_SERVICE_NAME'),
@@ -16196,9 +16225,9 @@ function initializeSignOzTracing(config) {
16196
16225
  })(),
16197
16226
  batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
16198
16227
  maxQueueSize: 100,
16199
- scheduledDelayMillis: 3000, // Kirim lebih cepat (3 detik)
16200
- exportTimeoutMillis: 10000, // Timeout lebih pendek (10 detik)
16201
- maxExportBatchSize: 30 // Batch lebih kecil untuk menghindari timeout
16228
+ scheduledDelayMillis: 2000, // Kirim lebih cepat (2 detik)
16229
+ exportTimeoutMillis: 5000, // Timeout lebih pendek (5 detik)
16230
+ maxExportBatchSize: 20 // Batch lebih kecil untuk menghindari timeout
16202
16231
  },
16203
16232
  allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
16204
16233
  enableRequestLogging: (config === null || config === void 0 ? void 0 : config.enableRequestLogging) !== undefined ? config.enableRequestLogging : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_REQUEST_LOGGING') === 'true' || true),
@@ -16232,14 +16261,20 @@ function initializeSignOzTracing(config) {
16232
16261
  const exporter = new OTLPTraceExporter({
16233
16262
  url: effectiveConfig.url,
16234
16263
  headers: effectiveConfig.headers,
16235
- timeoutMillis: 10000 // Timeout lebih pendek (10 detik)
16264
+ timeoutMillis: 5000 // Timeout lebih pendek (5 detik) untuk fail fast
16236
16265
  });
16237
16266
  // Wrap exporter to suppress timeout errors completely
16238
16267
  const originalExport = exporter.export.bind(exporter);
16239
16268
  exporter.export = function (spans, resultCallback) {
16240
16269
  // Wrap in try-catch to prevent any errors from propagating
16241
16270
  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
16242
16276
  originalExport(spans, (result) => {
16277
+ clearTimeout(timeoutId);
16243
16278
  // Suppress ALL errors to prevent console noise and Zone.js catching them
16244
16279
  if (result.error) {
16245
16280
  const errorMessage = String(result.error);