@echoteam/signoz-react 1.2.13 → 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.d.ts +2 -0
- package/dist/index.esm.js +236 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +236 -34
- package/dist/index.js.map +1 -1
- package/dist/types/tracing.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -15548,23 +15548,75 @@ function addXHRLogging(config) {
|
|
|
15548
15548
|
};
|
|
15549
15549
|
}
|
|
15550
15550
|
// Fungsi untuk menambahkan error tracking
|
|
15551
|
-
function addErrorTracking(
|
|
15551
|
+
function addErrorTracking(config) {
|
|
15552
|
+
// Helper function to check if URL should be ignored
|
|
15553
|
+
const shouldIgnoreUrl = (url) => {
|
|
15554
|
+
if (!url)
|
|
15555
|
+
return false;
|
|
15556
|
+
return config.ignoreNetworkErrorUrls.some(pattern => {
|
|
15557
|
+
if (pattern instanceof RegExp) {
|
|
15558
|
+
return pattern.test(url);
|
|
15559
|
+
}
|
|
15560
|
+
return url.includes(pattern);
|
|
15561
|
+
});
|
|
15562
|
+
};
|
|
15552
15563
|
// Track unhandled errors
|
|
15553
15564
|
window.addEventListener('error', (event) => {
|
|
15554
15565
|
var _a, _b;
|
|
15555
|
-
// Skip SignOz internal timeout errors
|
|
15566
|
+
// Skip SignOz internal timeout errors and network errors
|
|
15556
15567
|
const errorMessage = event.message || '';
|
|
15557
15568
|
const errorStack = ((_a = event.error) === null || _a === void 0 ? void 0 : _a.stack) || '';
|
|
15558
|
-
const
|
|
15569
|
+
const errorFilename = event.filename || '';
|
|
15570
|
+
const isSignOzTimeout = ((errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) &&
|
|
15559
15571
|
(errorMessage.includes('BatchSpanProcessor') ||
|
|
15572
|
+
errorMessage.includes('OTLP') ||
|
|
15573
|
+
errorMessage.includes('exporter') ||
|
|
15560
15574
|
errorStack.includes('BatchSpanProcessor') ||
|
|
15575
|
+
errorStack.includes('OTLPTraceExporter') ||
|
|
15561
15576
|
errorStack.includes('zone.js') ||
|
|
15562
|
-
errorStack.includes('SignOz')
|
|
15563
|
-
|
|
15564
|
-
|
|
15577
|
+
errorStack.includes('SignOz') ||
|
|
15578
|
+
errorFilename.includes('zone.js')));
|
|
15579
|
+
// Also skip generic timeout errors that might be from SignOz
|
|
15580
|
+
const isGenericTimeout = (errorMessage === 'Timeout' ||
|
|
15581
|
+
errorMessage === 'timeout' ||
|
|
15582
|
+
(errorMessage.includes('Timeout') && errorStack.includes('zone.js')));
|
|
15583
|
+
if (isSignOzTimeout || isGenericTimeout) {
|
|
15584
|
+
if (config.enableConsoleLog) {
|
|
15565
15585
|
console.warn('[SignOz] Span export timeout detected (safe to ignore - not tracking this error)');
|
|
15566
15586
|
}
|
|
15567
15587
|
event.preventDefault(); // Prevent the error from propagating
|
|
15588
|
+
event.stopPropagation(); // Stop event bubbling
|
|
15589
|
+
event.stopImmediatePropagation(); // Stop other listeners
|
|
15590
|
+
return;
|
|
15591
|
+
}
|
|
15592
|
+
// Skip network errors if trackNetworkErrors is disabled
|
|
15593
|
+
if (!config.trackNetworkErrors) {
|
|
15594
|
+
const isNetworkError = (errorMessage.includes('XHR request failed') ||
|
|
15595
|
+
errorMessage.includes('Failed to fetch') ||
|
|
15596
|
+
errorMessage.includes('Network request failed') ||
|
|
15597
|
+
errorMessage.includes('NetworkError') ||
|
|
15598
|
+
errorMessage.includes('net::ERR_') ||
|
|
15599
|
+
errorStack.includes('XMLHttpRequest') ||
|
|
15600
|
+
errorStack.includes('fetch'));
|
|
15601
|
+
if (isNetworkError) {
|
|
15602
|
+
if (config.enableConsoleLog) {
|
|
15603
|
+
console.warn('[SignOz] Network error detected (not tracking - trackNetworkErrors is disabled)');
|
|
15604
|
+
}
|
|
15605
|
+
event.preventDefault();
|
|
15606
|
+
event.stopPropagation();
|
|
15607
|
+
event.stopImmediatePropagation();
|
|
15608
|
+
return;
|
|
15609
|
+
}
|
|
15610
|
+
}
|
|
15611
|
+
// Check if URL should be ignored
|
|
15612
|
+
const errorUrl = event.filename || '';
|
|
15613
|
+
if (shouldIgnoreUrl(errorUrl)) {
|
|
15614
|
+
if (config.enableConsoleLog) {
|
|
15615
|
+
console.warn('[SignOz] Error from ignored URL (not tracking):', errorUrl);
|
|
15616
|
+
}
|
|
15617
|
+
event.preventDefault();
|
|
15618
|
+
event.stopPropagation();
|
|
15619
|
+
event.stopImmediatePropagation();
|
|
15568
15620
|
return;
|
|
15569
15621
|
}
|
|
15570
15622
|
const tracer = trace.getTracer('error-tracker');
|
|
@@ -15585,7 +15637,7 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15585
15637
|
span.setAttribute('error.name', event.error.name || 'Error');
|
|
15586
15638
|
}
|
|
15587
15639
|
span.setStatus({ code: SpanStatusCode.ERROR, message: event.message });
|
|
15588
|
-
if (enableConsoleLog) {
|
|
15640
|
+
if (config.enableConsoleLog) {
|
|
15589
15641
|
console.error('[SignOz] Unhandled Error:', {
|
|
15590
15642
|
message: event.message,
|
|
15591
15643
|
filename: event.filename,
|
|
@@ -15603,17 +15655,45 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15603
15655
|
const reason = String(event.reason);
|
|
15604
15656
|
const stack = event.reason instanceof Error ? (event.reason.stack || '') : '';
|
|
15605
15657
|
// Check if this is a SignOz internal timeout error
|
|
15606
|
-
const isSignOzTimeout = (reason.includes('Timeout') &&
|
|
15658
|
+
const isSignOzTimeout = ((reason.includes('Timeout') || reason.includes('timeout') || reason.includes('ETIMEDOUT')) &&
|
|
15607
15659
|
(reason.includes('BatchSpanProcessor') ||
|
|
15660
|
+
reason.includes('OTLP') ||
|
|
15661
|
+
reason.includes('exporter') ||
|
|
15608
15662
|
stack.includes('BatchSpanProcessor') ||
|
|
15663
|
+
stack.includes('OTLPTraceExporter') ||
|
|
15609
15664
|
stack.includes('zone.js')));
|
|
15610
|
-
|
|
15611
|
-
|
|
15665
|
+
// Also skip generic timeout errors that might be from SignOz
|
|
15666
|
+
const isGenericTimeout = (reason === 'Timeout' ||
|
|
15667
|
+
reason === 'timeout' ||
|
|
15668
|
+
(reason.includes('Timeout') && stack.includes('zone.js')));
|
|
15669
|
+
if (isSignOzTimeout || isGenericTimeout) {
|
|
15670
|
+
if (config.enableConsoleLog) {
|
|
15612
15671
|
console.warn('[SignOz] Span export timeout (this is usually safe to ignore - check if SignOz endpoint is reachable)');
|
|
15613
15672
|
}
|
|
15614
15673
|
event.preventDefault(); // Prevent the error from being logged
|
|
15674
|
+
event.stopPropagation(); // Stop event bubbling
|
|
15675
|
+
event.stopImmediatePropagation(); // Stop other listeners
|
|
15615
15676
|
return;
|
|
15616
15677
|
}
|
|
15678
|
+
// Skip network errors if trackNetworkErrors is disabled
|
|
15679
|
+
if (!config.trackNetworkErrors) {
|
|
15680
|
+
const isNetworkError = (reason.includes('XHR request failed') ||
|
|
15681
|
+
reason.includes('Failed to fetch') ||
|
|
15682
|
+
reason.includes('Network request failed') ||
|
|
15683
|
+
reason.includes('NetworkError') ||
|
|
15684
|
+
reason.includes('net::ERR_') ||
|
|
15685
|
+
stack.includes('XMLHttpRequest') ||
|
|
15686
|
+
stack.includes('fetch'));
|
|
15687
|
+
if (isNetworkError) {
|
|
15688
|
+
if (config.enableConsoleLog) {
|
|
15689
|
+
console.warn('[SignOz] Network error in promise (not tracking - trackNetworkErrors is disabled)');
|
|
15690
|
+
}
|
|
15691
|
+
event.preventDefault();
|
|
15692
|
+
event.stopPropagation();
|
|
15693
|
+
event.stopImmediatePropagation();
|
|
15694
|
+
return;
|
|
15695
|
+
}
|
|
15696
|
+
}
|
|
15617
15697
|
const tracer = trace.getTracer('error-tracker');
|
|
15618
15698
|
const span = tracer.startSpan('Unhandled Promise Rejection');
|
|
15619
15699
|
span.setAttribute('error.type', 'unhandled_rejection');
|
|
@@ -15630,7 +15710,7 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15630
15710
|
span.setAttribute('error.name', event.reason.name || 'Error');
|
|
15631
15711
|
}
|
|
15632
15712
|
span.setStatus({ code: SpanStatusCode.ERROR, message: String(event.reason) });
|
|
15633
|
-
if (enableConsoleLog) {
|
|
15713
|
+
if (config.enableConsoleLog) {
|
|
15634
15714
|
console.error('[SignOz] Unhandled Promise Rejection:', event.reason, 'on page', window.location.pathname);
|
|
15635
15715
|
}
|
|
15636
15716
|
span.end();
|
|
@@ -15644,14 +15724,39 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15644
15724
|
// Skip SignOz internal timeout errors
|
|
15645
15725
|
const errorMessage = error.message || String(error);
|
|
15646
15726
|
const errorStack = error.stack || '';
|
|
15647
|
-
const isSignOzTimeout = (errorMessage.includes('Timeout') &&
|
|
15648
|
-
(
|
|
15649
|
-
|
|
15650
|
-
|
|
15727
|
+
const isSignOzTimeout = ((errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) &&
|
|
15728
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
15729
|
+
errorMessage.includes('OTLP') ||
|
|
15730
|
+
errorMessage.includes('exporter') ||
|
|
15731
|
+
errorStack.includes('BatchSpanProcessor') ||
|
|
15732
|
+
errorStack.includes('OTLPTraceExporter') ||
|
|
15733
|
+
errorStack.includes('zone.js')));
|
|
15734
|
+
// Also skip generic timeout errors
|
|
15735
|
+
const isGenericTimeout = (errorMessage === 'Timeout' ||
|
|
15736
|
+
errorMessage === 'timeout' ||
|
|
15737
|
+
(errorMessage.includes('Timeout') && errorStack.includes('zone.js')));
|
|
15738
|
+
if (isSignOzTimeout || isGenericTimeout) {
|
|
15739
|
+
if (config.enableConsoleLog) {
|
|
15651
15740
|
console.warn('[SignOz] Zone.js caught span export timeout (safe to ignore)');
|
|
15652
15741
|
}
|
|
15653
15742
|
return; // Don't track this error
|
|
15654
15743
|
}
|
|
15744
|
+
// Skip network errors if trackNetworkErrors is disabled
|
|
15745
|
+
if (!config.trackNetworkErrors) {
|
|
15746
|
+
const isNetworkError = (errorMessage.includes('XHR request failed') ||
|
|
15747
|
+
errorMessage.includes('Failed to fetch') ||
|
|
15748
|
+
errorMessage.includes('Network request failed') ||
|
|
15749
|
+
errorMessage.includes('NetworkError') ||
|
|
15750
|
+
errorMessage.includes('net::ERR_') ||
|
|
15751
|
+
errorStack.includes('XMLHttpRequest') ||
|
|
15752
|
+
errorStack.includes('fetch'));
|
|
15753
|
+
if (isNetworkError) {
|
|
15754
|
+
if (config.enableConsoleLog) {
|
|
15755
|
+
console.warn('[SignOz] Zone.js caught network error (not tracking - trackNetworkErrors is disabled)');
|
|
15756
|
+
}
|
|
15757
|
+
return;
|
|
15758
|
+
}
|
|
15759
|
+
}
|
|
15655
15760
|
const tracer = trace.getTracer('error-tracker');
|
|
15656
15761
|
const span = tracer.startSpan('Zone.js Error');
|
|
15657
15762
|
span.setAttribute('error.type', 'zone_error');
|
|
@@ -15667,7 +15772,7 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15667
15772
|
}
|
|
15668
15773
|
span.recordException(error);
|
|
15669
15774
|
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message || String(error) });
|
|
15670
|
-
if (enableConsoleLog) {
|
|
15775
|
+
if (config.enableConsoleLog) {
|
|
15671
15776
|
console.error('[SignOz] Zone.js Error:', error, 'on page', window.location.pathname);
|
|
15672
15777
|
}
|
|
15673
15778
|
span.end();
|
|
@@ -15690,6 +15795,16 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15690
15795
|
// Just call original console.error without tracking
|
|
15691
15796
|
return originalConsoleError.apply(console, args);
|
|
15692
15797
|
}
|
|
15798
|
+
// Skip network errors if trackNetworkErrors is disabled
|
|
15799
|
+
const isNetworkError = (errorMessage.includes('XHR request failed') ||
|
|
15800
|
+
errorMessage.includes('Failed to fetch') ||
|
|
15801
|
+
errorMessage.includes('Network request failed') ||
|
|
15802
|
+
errorMessage.includes('NetworkError') ||
|
|
15803
|
+
errorMessage.includes('net::ERR_'));
|
|
15804
|
+
if (isNetworkError && !config.trackNetworkErrors) {
|
|
15805
|
+
// Just call original console.error without tracking
|
|
15806
|
+
return originalConsoleError.apply(console, args);
|
|
15807
|
+
}
|
|
15693
15808
|
if (errorMessage.includes('React') || errorMessage.includes('TypeError') || errorMessage.includes('Uncaught')) {
|
|
15694
15809
|
const tracer = trace.getTracer('error-tracker');
|
|
15695
15810
|
const span = tracer.startSpan('Console Error');
|
|
@@ -16019,6 +16134,63 @@ function addWebSocketLogging(config) {
|
|
|
16019
16134
|
*/
|
|
16020
16135
|
function initializeSignOzTracing(config) {
|
|
16021
16136
|
try {
|
|
16137
|
+
// Install global error suppression for SignOz timeout errors FIRST
|
|
16138
|
+
// This must be done before any other initialization
|
|
16139
|
+
const originalWindowError = window.onerror;
|
|
16140
|
+
window.onerror = function (message, source, lineno, colno, error) {
|
|
16141
|
+
const errorMessage = String(message);
|
|
16142
|
+
const errorStack = (error === null || error === void 0 ? void 0 : error.stack) || '';
|
|
16143
|
+
const errorSource = source || '';
|
|
16144
|
+
// Suppress SignOz timeout errors globally - be very aggressive
|
|
16145
|
+
const isSignOzTimeout = ((errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) &&
|
|
16146
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
16147
|
+
errorMessage.includes('OTLP') ||
|
|
16148
|
+
errorMessage.includes('exporter') ||
|
|
16149
|
+
errorStack.includes('BatchSpanProcessor') ||
|
|
16150
|
+
errorStack.includes('OTLPTraceExporter') ||
|
|
16151
|
+
errorStack.includes('zone.js') ||
|
|
16152
|
+
errorSource.includes('zone.js') ||
|
|
16153
|
+
errorStack.includes('signoz') ||
|
|
16154
|
+
errorSource.includes('signoz')));
|
|
16155
|
+
// Also suppress generic timeout errors from zone.js or bundle.js
|
|
16156
|
+
const isGenericTimeout = ((errorMessage === 'Timeout' || errorMessage === 'timeout') ||
|
|
16157
|
+
(errorMessage.includes('Timeout') && (errorStack.includes('zone.js') || errorSource.includes('bundle.js'))));
|
|
16158
|
+
if (isSignOzTimeout || isGenericTimeout) {
|
|
16159
|
+
// Suppress completely - don't log, don't propagate
|
|
16160
|
+
return true; // Returning true prevents default error handling
|
|
16161
|
+
}
|
|
16162
|
+
// Call original handler for other errors
|
|
16163
|
+
if (originalWindowError) {
|
|
16164
|
+
return originalWindowError.call(window, message, source, lineno, colno, error);
|
|
16165
|
+
}
|
|
16166
|
+
return false;
|
|
16167
|
+
};
|
|
16168
|
+
// Also suppress unhandledrejection for timeout errors
|
|
16169
|
+
const originalUnhandledRejection = window.onunhandledrejection;
|
|
16170
|
+
window.addEventListener('unhandledrejection', function (event) {
|
|
16171
|
+
const reason = String(event.reason);
|
|
16172
|
+
const stack = event.reason instanceof Error ? (event.reason.stack || '') : '';
|
|
16173
|
+
const isSignOzTimeout = ((reason.includes('Timeout') || reason.includes('timeout') || reason.includes('ETIMEDOUT')) &&
|
|
16174
|
+
(reason.includes('BatchSpanProcessor') ||
|
|
16175
|
+
reason.includes('OTLP') ||
|
|
16176
|
+
reason.includes('exporter') ||
|
|
16177
|
+
stack.includes('BatchSpanProcessor') ||
|
|
16178
|
+
stack.includes('OTLPTraceExporter') ||
|
|
16179
|
+
stack.includes('zone.js') ||
|
|
16180
|
+
stack.includes('signoz')));
|
|
16181
|
+
const isGenericTimeout = (reason === 'Timeout' ||
|
|
16182
|
+
reason === 'timeout' ||
|
|
16183
|
+
(reason.includes('Timeout') && stack.includes('zone.js')));
|
|
16184
|
+
if (isSignOzTimeout || isGenericTimeout) {
|
|
16185
|
+
event.preventDefault();
|
|
16186
|
+
event.stopPropagation();
|
|
16187
|
+
event.stopImmediatePropagation();
|
|
16188
|
+
return;
|
|
16189
|
+
}
|
|
16190
|
+
if (originalUnhandledRejection) {
|
|
16191
|
+
originalUnhandledRejection.call(window, event);
|
|
16192
|
+
}
|
|
16193
|
+
}, true);
|
|
16022
16194
|
// Gabungkan konfigurasi dari parameter, process.env, dan window
|
|
16023
16195
|
const effectiveConfig = {
|
|
16024
16196
|
serviceName: (config === null || config === void 0 ? void 0 : config.serviceName) || getConfigValue('REACT_APP_SIGNOZ_SERVICE_NAME'),
|
|
@@ -16033,9 +16205,9 @@ function initializeSignOzTracing(config) {
|
|
|
16033
16205
|
})(),
|
|
16034
16206
|
batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
|
|
16035
16207
|
maxQueueSize: 100,
|
|
16036
|
-
scheduledDelayMillis:
|
|
16037
|
-
exportTimeoutMillis:
|
|
16038
|
-
maxExportBatchSize:
|
|
16208
|
+
scheduledDelayMillis: 2000, // Kirim lebih cepat (2 detik)
|
|
16209
|
+
exportTimeoutMillis: 5000, // Timeout lebih pendek (5 detik)
|
|
16210
|
+
maxExportBatchSize: 20 // Batch lebih kecil untuk menghindari timeout
|
|
16039
16211
|
},
|
|
16040
16212
|
allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
|
|
16041
16213
|
enableRequestLogging: (config === null || config === void 0 ? void 0 : config.enableRequestLogging) !== undefined ? config.enableRequestLogging : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_REQUEST_LOGGING') === 'true' || true),
|
|
@@ -16047,7 +16219,9 @@ function initializeSignOzTracing(config) {
|
|
|
16047
16219
|
enableNavigationTracking: (config === null || config === void 0 ? void 0 : config.enableNavigationTracking) !== undefined ? config.enableNavigationTracking : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_NAVIGATION_TRACKING') === 'true'),
|
|
16048
16220
|
enableConsoleLog: (config === null || config === void 0 ? void 0 : config.enableConsoleLog) !== undefined ? config.enableConsoleLog : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_CONSOLE_LOG') === 'true'),
|
|
16049
16221
|
enableWebSocketLogging: (config === null || config === void 0 ? void 0 : config.enableWebSocketLogging) !== undefined ? config.enableWebSocketLogging : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_WEBSOCKET_LOGGING') === 'true'),
|
|
16050
|
-
logWebSocketMessages: (config === null || config === void 0 ? void 0 : config.logWebSocketMessages) !== undefined ? config.logWebSocketMessages : (getConfigValue('REACT_APP_SIGNOZ_LOG_WEBSOCKET_MESSAGES') === 'true')
|
|
16222
|
+
logWebSocketMessages: (config === null || config === void 0 ? void 0 : config.logWebSocketMessages) !== undefined ? config.logWebSocketMessages : (getConfigValue('REACT_APP_SIGNOZ_LOG_WEBSOCKET_MESSAGES') === 'true'),
|
|
16223
|
+
trackNetworkErrors: (config === null || config === void 0 ? void 0 : config.trackNetworkErrors) !== undefined ? config.trackNetworkErrors : (getConfigValue('REACT_APP_SIGNOZ_TRACK_NETWORK_ERRORS') === 'true'),
|
|
16224
|
+
ignoreNetworkErrorUrls: (config === null || config === void 0 ? void 0 : config.ignoreNetworkErrorUrls) || []
|
|
16051
16225
|
};
|
|
16052
16226
|
// Validasi konfigurasi
|
|
16053
16227
|
const { isValid, missingFields } = validateConfig(effectiveConfig);
|
|
@@ -16067,32 +16241,55 @@ function initializeSignOzTracing(config) {
|
|
|
16067
16241
|
const exporter = new OTLPTraceExporter({
|
|
16068
16242
|
url: effectiveConfig.url,
|
|
16069
16243
|
headers: effectiveConfig.headers,
|
|
16070
|
-
timeoutMillis:
|
|
16244
|
+
timeoutMillis: 5000 // Timeout lebih pendek (5 detik) untuk fail fast
|
|
16071
16245
|
});
|
|
16072
|
-
// Wrap exporter to suppress timeout errors
|
|
16246
|
+
// Wrap exporter to suppress timeout errors completely
|
|
16073
16247
|
const originalExport = exporter.export.bind(exporter);
|
|
16074
16248
|
exporter.export = function (spans, resultCallback) {
|
|
16075
|
-
|
|
16076
|
-
|
|
16077
|
-
if
|
|
16078
|
-
|
|
16079
|
-
|
|
16249
|
+
// Wrap in try-catch to prevent any errors from propagating
|
|
16250
|
+
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
|
+
originalExport(spans, (result) => {
|
|
16257
|
+
clearTimeout(timeoutId);
|
|
16258
|
+
// Suppress ALL errors to prevent console noise and Zone.js catching them
|
|
16259
|
+
if (result.error) {
|
|
16260
|
+
const errorMessage = String(result.error);
|
|
16261
|
+
if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
|
|
16262
|
+
if (effectiveConfig.enableConsoleLog) {
|
|
16263
|
+
console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
|
|
16264
|
+
}
|
|
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
|
|
16080
16270
|
if (effectiveConfig.enableConsoleLog) {
|
|
16081
|
-
console.warn('[SignOz] Span export
|
|
16271
|
+
console.warn('[SignOz] Span export error (suppressed):', errorMessage);
|
|
16082
16272
|
}
|
|
16083
|
-
// Call callback with success to prevent error propagation
|
|
16084
16273
|
resultCallback({ code: 0 });
|
|
16085
16274
|
return;
|
|
16086
16275
|
}
|
|
16276
|
+
resultCallback(result);
|
|
16277
|
+
});
|
|
16278
|
+
}
|
|
16279
|
+
catch (error) {
|
|
16280
|
+
// Catch any synchronous errors and suppress them
|
|
16281
|
+
if (effectiveConfig.enableConsoleLog) {
|
|
16282
|
+
console.warn('[SignOz] Span export exception (suppressed):', error);
|
|
16087
16283
|
}
|
|
16088
|
-
resultCallback(
|
|
16089
|
-
}
|
|
16284
|
+
resultCallback({ code: 0 });
|
|
16285
|
+
}
|
|
16090
16286
|
};
|
|
16091
16287
|
// Set up the span processor with configuration
|
|
16092
16288
|
const processor = new BatchSpanProcessor(exporter, {
|
|
16093
16289
|
maxQueueSize: effectiveConfig.batchSpanProcessorConfig.maxQueueSize,
|
|
16094
16290
|
scheduledDelayMillis: effectiveConfig.batchSpanProcessorConfig.scheduledDelayMillis,
|
|
16095
|
-
exportTimeoutMillis: effectiveConfig.batchSpanProcessorConfig.exportTimeoutMillis
|
|
16291
|
+
exportTimeoutMillis: effectiveConfig.batchSpanProcessorConfig.exportTimeoutMillis,
|
|
16292
|
+
maxExportBatchSize: effectiveConfig.batchSpanProcessorConfig.maxExportBatchSize
|
|
16096
16293
|
});
|
|
16097
16294
|
// Create and configure the WebTracerProvider
|
|
16098
16295
|
const provider = new WebTracerProvider({
|
|
@@ -16149,7 +16346,11 @@ function initializeSignOzTracing(config) {
|
|
|
16149
16346
|
}
|
|
16150
16347
|
// Tambahkan error tracking
|
|
16151
16348
|
if (effectiveConfig.enableErrorTracking) {
|
|
16152
|
-
addErrorTracking(
|
|
16349
|
+
addErrorTracking({
|
|
16350
|
+
enableConsoleLog: effectiveConfig.enableConsoleLog,
|
|
16351
|
+
trackNetworkErrors: effectiveConfig.trackNetworkErrors,
|
|
16352
|
+
ignoreNetworkErrorUrls: effectiveConfig.ignoreNetworkErrorUrls
|
|
16353
|
+
});
|
|
16153
16354
|
}
|
|
16154
16355
|
// Tambahkan navigation tracking
|
|
16155
16356
|
if (effectiveConfig.enableNavigationTracking) {
|
|
@@ -16177,7 +16378,8 @@ function initializeSignOzTracing(config) {
|
|
|
16177
16378
|
enableErrorTracking: effectiveConfig.enableErrorTracking,
|
|
16178
16379
|
enableNavigationTracking: effectiveConfig.enableNavigationTracking,
|
|
16179
16380
|
enableWebSocketLogging: effectiveConfig.enableWebSocketLogging,
|
|
16180
|
-
logWebSocketMessages: effectiveConfig.logWebSocketMessages
|
|
16381
|
+
logWebSocketMessages: effectiveConfig.logWebSocketMessages,
|
|
16382
|
+
trackNetworkErrors: effectiveConfig.trackNetworkErrors
|
|
16181
16383
|
});
|
|
16182
16384
|
console.log('SignOz: Tracing berhasil diinisialisasi');
|
|
16183
16385
|
}
|