@echoteam/signoz-react 1.2.14 → 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 +76 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +76 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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
|
-
|
|
16172
|
-
|
|
16173
|
-
|
|
16174
|
-
|
|
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:
|
|
16200
|
-
exportTimeoutMillis:
|
|
16201
|
-
maxExportBatchSize:
|
|
16228
|
+
scheduledDelayMillis: 2000, // Kirim lebih cepat (2 detik)
|
|
16229
|
+
exportTimeoutMillis: 3000, // Timeout lebih pendek (3 detik) untuk fail fast
|
|
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,41 +16261,63 @@ function initializeSignOzTracing(config) {
|
|
|
16232
16261
|
const exporter = new OTLPTraceExporter({
|
|
16233
16262
|
url: effectiveConfig.url,
|
|
16234
16263
|
headers: effectiveConfig.headers,
|
|
16235
|
-
timeoutMillis:
|
|
16264
|
+
timeoutMillis: 3000 // Timeout lebih pendek (3 detik) untuk fail fast
|
|
16236
16265
|
});
|
|
16237
|
-
// Wrap exporter to suppress timeout errors completely
|
|
16266
|
+
// Wrap exporter to suppress timeout errors completely and prevent them from reaching Zone.js
|
|
16238
16267
|
const originalExport = exporter.export.bind(exporter);
|
|
16268
|
+
let timeoutWarningShown = false;
|
|
16239
16269
|
exporter.export = function (spans, resultCallback) {
|
|
16240
|
-
|
|
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
|
|
16241
16291
|
try {
|
|
16242
16292
|
originalExport(spans, (result) => {
|
|
16243
|
-
|
|
16293
|
+
clearTimeout(timeoutId);
|
|
16294
|
+
// Always treat as success to prevent any error propagation
|
|
16244
16295
|
if (result.error) {
|
|
16245
16296
|
const errorMessage = String(result.error);
|
|
16246
|
-
if (
|
|
16247
|
-
if (
|
|
16297
|
+
if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
|
|
16298
|
+
if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
|
|
16248
16299
|
console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
|
|
16249
16300
|
}
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
// For other errors, also suppress but log if console logging is enabled
|
|
16255
|
-
if (effectiveConfig.enableConsoleLog) {
|
|
16256
|
-
console.warn('[SignOz] Span export error (suppressed):', errorMessage);
|
|
16301
|
+
else {
|
|
16302
|
+
console.warn('[SignOz] Span export error (suppressed):', errorMessage);
|
|
16303
|
+
}
|
|
16304
|
+
timeoutWarningShown = true;
|
|
16257
16305
|
}
|
|
16258
|
-
|
|
16306
|
+
// Always return success to prevent error propagation
|
|
16307
|
+
safeCallback({ code: 0 });
|
|
16259
16308
|
return;
|
|
16260
16309
|
}
|
|
16261
|
-
|
|
16310
|
+
safeCallback(result);
|
|
16262
16311
|
});
|
|
16263
16312
|
}
|
|
16264
16313
|
catch (error) {
|
|
16314
|
+
clearTimeout(timeoutId);
|
|
16265
16315
|
// Catch any synchronous errors and suppress them
|
|
16266
|
-
if (effectiveConfig.enableConsoleLog) {
|
|
16316
|
+
if (!timeoutWarningShown && effectiveConfig.enableConsoleLog) {
|
|
16267
16317
|
console.warn('[SignOz] Span export exception (suppressed):', error);
|
|
16318
|
+
timeoutWarningShown = true;
|
|
16268
16319
|
}
|
|
16269
|
-
|
|
16320
|
+
safeCallback({ code: 0 });
|
|
16270
16321
|
}
|
|
16271
16322
|
};
|
|
16272
16323
|
// Set up the span processor with configuration
|