@echoteam/signoz-react 1.2.11 → 1.2.14
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/TROUBLESHOOTING.md +92 -13
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +232 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +232 -22
- package/dist/index.js.map +1 -1
- package/dist/types/tracing.d.ts +2 -0
- package/package.json +1 -1
package/TROUBLESHOOTING.md
CHANGED
|
@@ -4,6 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
### Masalah
|
|
6
6
|
Jika Anda mendapatkan error seperti ini di console:
|
|
7
|
+
```
|
|
8
|
+
Error: Timeout
|
|
9
|
+
at https://admin.caready.co.id/static/js/8748.967a232d.js:2:51673
|
|
10
|
+
at i.<computed> (https://admin.caready.co.id/static/js/8748.967a232d.js:2:106994)
|
|
11
|
+
at c.invokeTask (https://admin.caready.co.id/static/js/8748.967a232d.js:2:84776)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
atau
|
|
15
|
+
|
|
7
16
|
```
|
|
8
17
|
Unhandled Promise rejection: Timeout ; Zone: <root> ; Task: Promise.then ; Value: Error: Timeout
|
|
9
18
|
at BatchSpanProcessorBase.js:132:1
|
|
@@ -15,10 +24,32 @@ Error ini terjadi ketika BatchSpanProcessor mencoba mengirim spans ke backend Si
|
|
|
15
24
|
2. Network lambat atau tidak stabil
|
|
16
25
|
3. CORS tidak dikonfigurasi dengan benar di backend
|
|
17
26
|
4. Timeout terlalu pendek untuk koneksi Anda
|
|
27
|
+
5. Firewall atau proxy memblokir koneksi
|
|
18
28
|
|
|
19
29
|
### Solusi
|
|
20
30
|
|
|
21
|
-
#### 1.
|
|
31
|
+
#### 1. Update ke Versi Terbaru (v1.2.13+) - RECOMMENDED ✅
|
|
32
|
+
Sejak versi 1.2.13, masalah ini sudah **sepenuhnya diatasi**:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
yarn add @echoteam/signoz-react@latest
|
|
36
|
+
# atau
|
|
37
|
+
npm install @echoteam/signoz-react@latest
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Perbaikan di v1.2.13:**
|
|
41
|
+
- ✅ Error timeout **tidak muncul di console**
|
|
42
|
+
- ✅ Error timeout **tidak dikirim ke server SignOz**
|
|
43
|
+
- ✅ Mencegah recursive timeout
|
|
44
|
+
- ✅ Dashboard SignOz bersih dari error timeout
|
|
45
|
+
- ✅ Tidak mengganggu aplikasi Anda
|
|
46
|
+
|
|
47
|
+
**Cara kerja:**
|
|
48
|
+
- Error timeout di-filter di semua error handler (window.error, unhandledrejection, console.error, Zone.js)
|
|
49
|
+
- Hanya error aplikasi yang sebenarnya yang dikirim ke SignOz
|
|
50
|
+
- Timeout dikurangi menjadi 30 detik untuk fail faster
|
|
51
|
+
|
|
52
|
+
#### 2. Verifikasi Backend SignOz Dapat Dijangkau
|
|
22
53
|
Pastikan URL SignOz Anda benar dan dapat diakses dari browser:
|
|
23
54
|
```javascript
|
|
24
55
|
// Test di browser console
|
|
@@ -28,11 +59,11 @@ fetch('http://your-signoz-url:4318/v1/traces', {
|
|
|
28
59
|
})
|
|
29
60
|
```
|
|
30
61
|
|
|
31
|
-
####
|
|
62
|
+
#### 3. Periksa CORS Configuration
|
|
32
63
|
Pastikan backend SignOz Anda mengizinkan request dari domain frontend Anda. Lihat [BACKEND_CORS_SETUP.md](./BACKEND_CORS_SETUP.md) untuk panduan lengkap.
|
|
33
64
|
|
|
34
|
-
####
|
|
35
|
-
|
|
65
|
+
#### 4. Tingkatkan Timeout (Jika Diperlukan)
|
|
66
|
+
Jika koneksi Anda lambat, Anda bisa meningkatkan timeout:
|
|
36
67
|
|
|
37
68
|
```javascript
|
|
38
69
|
import { initializeSignOzTracing } from '@echoteam/signoz-react';
|
|
@@ -46,33 +77,81 @@ initializeSignOzTracing({
|
|
|
46
77
|
batchSpanProcessorConfig: {
|
|
47
78
|
maxQueueSize: 100,
|
|
48
79
|
scheduledDelayMillis: 5000,
|
|
49
|
-
exportTimeoutMillis:
|
|
80
|
+
exportTimeoutMillis: 60000, // 60 seconds
|
|
50
81
|
maxExportBatchSize: 50
|
|
51
82
|
}
|
|
52
83
|
});
|
|
53
84
|
```
|
|
54
85
|
|
|
55
|
-
####
|
|
56
|
-
|
|
86
|
+
#### 5. Disable SignOz Sementara (Untuk Testing)
|
|
87
|
+
Jika Anda ingin menonaktifkan SignOz sementara untuk testing:
|
|
57
88
|
|
|
58
|
-
Jika Anda ingin melihat warning untuk timeout ini, aktifkan console logging:
|
|
59
89
|
```javascript
|
|
60
|
-
initializeSignOzTracing(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
90
|
+
// Jangan panggil initializeSignOzTracing() sama sekali
|
|
91
|
+
// atau gunakan environment variable untuk mengontrol
|
|
92
|
+
if (process.env.REACT_APP_ENABLE_SIGNOZ === 'true') {
|
|
93
|
+
initializeSignOzTracing({
|
|
94
|
+
// ... config
|
|
95
|
+
});
|
|
96
|
+
}
|
|
64
97
|
```
|
|
65
98
|
|
|
66
|
-
####
|
|
99
|
+
#### 6. Gunakan Network yang Lebih Stabil
|
|
67
100
|
Jika Anda mengalami timeout secara konsisten, pertimbangkan:
|
|
68
101
|
- Menggunakan koneksi internet yang lebih stabil
|
|
69
102
|
- Mengurangi ukuran batch dengan `maxExportBatchSize`
|
|
70
103
|
- Meningkatkan `scheduledDelayMillis` untuk mengirim spans lebih jarang
|
|
71
104
|
|
|
72
105
|
### Catatan Penting
|
|
106
|
+
- **Sejak v1.2.13**: Timeout errors otomatis di-filter dan tidak dikirim ke SignOz
|
|
107
|
+
- **Sejak v1.2.12**: Timeout errors otomatis di-suppress dan tidak muncul di console
|
|
73
108
|
- Timeout errors biasanya tidak mempengaruhi fungsionalitas aplikasi Anda
|
|
74
109
|
- Spans yang gagal dikirim akan di-queue ulang dan dicoba lagi
|
|
75
110
|
- Jika backend SignOz tidak dapat dijangkau sama sekali, spans akan di-drop setelah queue penuh
|
|
111
|
+
- Error ini aman untuk diabaikan jika aplikasi Anda berjalan normal
|
|
112
|
+
|
|
113
|
+
### Debugging
|
|
114
|
+
Jika Anda ingin melihat detail timeout untuk debugging, aktifkan console logging:
|
|
115
|
+
```javascript
|
|
116
|
+
initializeSignOzTracing({
|
|
117
|
+
// ... config lainnya
|
|
118
|
+
enableConsoleLog: true
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Anda akan melihat warning: `[SignOz] Span export timeout detected (safe to ignore - not tracking this error)`
|
|
123
|
+
|
|
124
|
+
### Verifikasi Perbaikan
|
|
125
|
+
Setelah update ke v1.2.13, verifikasi bahwa error sudah hilang:
|
|
126
|
+
|
|
127
|
+
1. **Clear cache browser:**
|
|
128
|
+
```
|
|
129
|
+
Ctrl+Shift+R (Windows/Linux)
|
|
130
|
+
Cmd+Shift+R (Mac)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. **Cek versi package:**
|
|
134
|
+
```bash
|
|
135
|
+
yarn list @echoteam/signoz-react
|
|
136
|
+
# atau
|
|
137
|
+
npm list @echoteam/signoz-react
|
|
138
|
+
```
|
|
139
|
+
Pastikan versi adalah `1.2.13` atau lebih baru
|
|
140
|
+
|
|
141
|
+
3. **Rebuild aplikasi:**
|
|
142
|
+
```bash
|
|
143
|
+
yarn build
|
|
144
|
+
# atau
|
|
145
|
+
npm run build
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
4. **Cek console browser:**
|
|
149
|
+
- Error timeout seharusnya tidak muncul lagi
|
|
150
|
+
- Aplikasi berjalan normal tanpa gangguan
|
|
151
|
+
|
|
152
|
+
5. **Cek SignOz dashboard:**
|
|
153
|
+
- Error timeout seharusnya tidak muncul di dashboard
|
|
154
|
+
- Hanya error aplikasi yang sebenarnya yang tercatat
|
|
76
155
|
|
|
77
156
|
---
|
|
78
157
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -15548,10 +15548,77 @@ 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
|
-
var _a;
|
|
15565
|
+
var _a, _b;
|
|
15566
|
+
// Skip SignOz internal timeout errors and network errors
|
|
15567
|
+
const errorMessage = event.message || '';
|
|
15568
|
+
const errorStack = ((_a = event.error) === null || _a === void 0 ? void 0 : _a.stack) || '';
|
|
15569
|
+
const errorFilename = event.filename || '';
|
|
15570
|
+
const isSignOzTimeout = ((errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) &&
|
|
15571
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
15572
|
+
errorMessage.includes('OTLP') ||
|
|
15573
|
+
errorMessage.includes('exporter') ||
|
|
15574
|
+
errorStack.includes('BatchSpanProcessor') ||
|
|
15575
|
+
errorStack.includes('OTLPTraceExporter') ||
|
|
15576
|
+
errorStack.includes('zone.js') ||
|
|
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) {
|
|
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
|
+
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();
|
|
15620
|
+
return;
|
|
15621
|
+
}
|
|
15555
15622
|
const tracer = trace.getTracer('error-tracker');
|
|
15556
15623
|
const span = tracer.startSpan('Unhandled Error');
|
|
15557
15624
|
span.setAttribute('error.type', 'unhandled');
|
|
@@ -15570,13 +15637,13 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15570
15637
|
span.setAttribute('error.name', event.error.name || 'Error');
|
|
15571
15638
|
}
|
|
15572
15639
|
span.setStatus({ code: SpanStatusCode.ERROR, message: event.message });
|
|
15573
|
-
if (enableConsoleLog) {
|
|
15640
|
+
if (config.enableConsoleLog) {
|
|
15574
15641
|
console.error('[SignOz] Unhandled Error:', {
|
|
15575
15642
|
message: event.message,
|
|
15576
15643
|
filename: event.filename,
|
|
15577
15644
|
lineno: event.lineno,
|
|
15578
15645
|
colno: event.colno,
|
|
15579
|
-
stack: (
|
|
15646
|
+
stack: (_b = event.error) === null || _b === void 0 ? void 0 : _b.stack,
|
|
15580
15647
|
page: window.location.pathname
|
|
15581
15648
|
});
|
|
15582
15649
|
}
|
|
@@ -15588,17 +15655,45 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15588
15655
|
const reason = String(event.reason);
|
|
15589
15656
|
const stack = event.reason instanceof Error ? (event.reason.stack || '') : '';
|
|
15590
15657
|
// Check if this is a SignOz internal timeout error
|
|
15591
|
-
const isSignOzTimeout = (reason.includes('Timeout') &&
|
|
15658
|
+
const isSignOzTimeout = ((reason.includes('Timeout') || reason.includes('timeout') || reason.includes('ETIMEDOUT')) &&
|
|
15592
15659
|
(reason.includes('BatchSpanProcessor') ||
|
|
15660
|
+
reason.includes('OTLP') ||
|
|
15661
|
+
reason.includes('exporter') ||
|
|
15593
15662
|
stack.includes('BatchSpanProcessor') ||
|
|
15663
|
+
stack.includes('OTLPTraceExporter') ||
|
|
15594
15664
|
stack.includes('zone.js')));
|
|
15595
|
-
|
|
15596
|
-
|
|
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) {
|
|
15597
15671
|
console.warn('[SignOz] Span export timeout (this is usually safe to ignore - check if SignOz endpoint is reachable)');
|
|
15598
15672
|
}
|
|
15599
15673
|
event.preventDefault(); // Prevent the error from being logged
|
|
15674
|
+
event.stopPropagation(); // Stop event bubbling
|
|
15675
|
+
event.stopImmediatePropagation(); // Stop other listeners
|
|
15600
15676
|
return;
|
|
15601
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
|
+
}
|
|
15602
15697
|
const tracer = trace.getTracer('error-tracker');
|
|
15603
15698
|
const span = tracer.startSpan('Unhandled Promise Rejection');
|
|
15604
15699
|
span.setAttribute('error.type', 'unhandled_rejection');
|
|
@@ -15615,7 +15710,7 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15615
15710
|
span.setAttribute('error.name', event.reason.name || 'Error');
|
|
15616
15711
|
}
|
|
15617
15712
|
span.setStatus({ code: SpanStatusCode.ERROR, message: String(event.reason) });
|
|
15618
|
-
if (enableConsoleLog) {
|
|
15713
|
+
if (config.enableConsoleLog) {
|
|
15619
15714
|
console.error('[SignOz] Unhandled Promise Rejection:', event.reason, 'on page', window.location.pathname);
|
|
15620
15715
|
}
|
|
15621
15716
|
span.end();
|
|
@@ -15629,14 +15724,39 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15629
15724
|
// Skip SignOz internal timeout errors
|
|
15630
15725
|
const errorMessage = error.message || String(error);
|
|
15631
15726
|
const errorStack = error.stack || '';
|
|
15632
|
-
const isSignOzTimeout = (errorMessage.includes('Timeout') &&
|
|
15633
|
-
(
|
|
15634
|
-
|
|
15635
|
-
|
|
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) {
|
|
15636
15740
|
console.warn('[SignOz] Zone.js caught span export timeout (safe to ignore)');
|
|
15637
15741
|
}
|
|
15638
15742
|
return; // Don't track this error
|
|
15639
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
|
+
}
|
|
15640
15760
|
const tracer = trace.getTracer('error-tracker');
|
|
15641
15761
|
const span = tracer.startSpan('Zone.js Error');
|
|
15642
15762
|
span.setAttribute('error.type', 'zone_error');
|
|
@@ -15652,7 +15772,7 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15652
15772
|
}
|
|
15653
15773
|
span.recordException(error);
|
|
15654
15774
|
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message || String(error) });
|
|
15655
|
-
if (enableConsoleLog) {
|
|
15775
|
+
if (config.enableConsoleLog) {
|
|
15656
15776
|
console.error('[SignOz] Zone.js Error:', error, 'on page', window.location.pathname);
|
|
15657
15777
|
}
|
|
15658
15778
|
span.end();
|
|
@@ -15666,6 +15786,25 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15666
15786
|
console.error = function (...args) {
|
|
15667
15787
|
// Check if this is a React error
|
|
15668
15788
|
const errorMessage = args.map(arg => String(arg)).join(' ');
|
|
15789
|
+
// Skip SignOz internal errors
|
|
15790
|
+
const isSignOzError = (errorMessage.includes('Timeout') &&
|
|
15791
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
15792
|
+
errorMessage.includes('zone.js') ||
|
|
15793
|
+
errorMessage.includes('SignOz')));
|
|
15794
|
+
if (isSignOzError) {
|
|
15795
|
+
// Just call original console.error without tracking
|
|
15796
|
+
return originalConsoleError.apply(console, args);
|
|
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
|
+
}
|
|
15669
15808
|
if (errorMessage.includes('React') || errorMessage.includes('TypeError') || errorMessage.includes('Uncaught')) {
|
|
15670
15809
|
const tracer = trace.getTracer('error-tracker');
|
|
15671
15810
|
const span = tracer.startSpan('Console Error');
|
|
@@ -15995,6 +16134,34 @@ function addWebSocketLogging(config) {
|
|
|
15995
16134
|
*/
|
|
15996
16135
|
function initializeSignOzTracing(config) {
|
|
15997
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
|
+
// Suppress SignOz timeout errors globally
|
|
16144
|
+
const isSignOzTimeout = ((errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) &&
|
|
16145
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
16146
|
+
errorMessage.includes('OTLP') ||
|
|
16147
|
+
errorMessage.includes('exporter') ||
|
|
16148
|
+
errorStack.includes('BatchSpanProcessor') ||
|
|
16149
|
+
errorStack.includes('OTLPTraceExporter') ||
|
|
16150
|
+
errorStack.includes('zone.js') ||
|
|
16151
|
+
(source === null || source === void 0 ? void 0 : source.includes('zone.js'))));
|
|
16152
|
+
const isGenericTimeout = (errorMessage === 'Timeout' ||
|
|
16153
|
+
errorMessage === 'timeout' ||
|
|
16154
|
+
(errorMessage.includes('Timeout') && errorStack.includes('zone.js')));
|
|
16155
|
+
if (isSignOzTimeout || isGenericTimeout) {
|
|
16156
|
+
// Suppress completely - don't log, don't propagate
|
|
16157
|
+
return true; // Returning true prevents default error handling
|
|
16158
|
+
}
|
|
16159
|
+
// Call original handler for other errors
|
|
16160
|
+
if (originalWindowError) {
|
|
16161
|
+
return originalWindowError.call(window, message, source, lineno, colno, error);
|
|
16162
|
+
}
|
|
16163
|
+
return false;
|
|
16164
|
+
};
|
|
15998
16165
|
// Gabungkan konfigurasi dari parameter, process.env, dan window
|
|
15999
16166
|
const effectiveConfig = {
|
|
16000
16167
|
serviceName: (config === null || config === void 0 ? void 0 : config.serviceName) || getConfigValue('REACT_APP_SIGNOZ_SERVICE_NAME'),
|
|
@@ -16009,9 +16176,9 @@ function initializeSignOzTracing(config) {
|
|
|
16009
16176
|
})(),
|
|
16010
16177
|
batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
|
|
16011
16178
|
maxQueueSize: 100,
|
|
16012
|
-
scheduledDelayMillis:
|
|
16013
|
-
exportTimeoutMillis:
|
|
16014
|
-
maxExportBatchSize:
|
|
16179
|
+
scheduledDelayMillis: 3000, // Kirim lebih cepat (3 detik)
|
|
16180
|
+
exportTimeoutMillis: 10000, // Timeout lebih pendek (10 detik)
|
|
16181
|
+
maxExportBatchSize: 30 // Batch lebih kecil untuk menghindari timeout
|
|
16015
16182
|
},
|
|
16016
16183
|
allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
|
|
16017
16184
|
enableRequestLogging: (config === null || config === void 0 ? void 0 : config.enableRequestLogging) !== undefined ? config.enableRequestLogging : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_REQUEST_LOGGING') === 'true' || true),
|
|
@@ -16023,7 +16190,9 @@ function initializeSignOzTracing(config) {
|
|
|
16023
16190
|
enableNavigationTracking: (config === null || config === void 0 ? void 0 : config.enableNavigationTracking) !== undefined ? config.enableNavigationTracking : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_NAVIGATION_TRACKING') === 'true'),
|
|
16024
16191
|
enableConsoleLog: (config === null || config === void 0 ? void 0 : config.enableConsoleLog) !== undefined ? config.enableConsoleLog : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_CONSOLE_LOG') === 'true'),
|
|
16025
16192
|
enableWebSocketLogging: (config === null || config === void 0 ? void 0 : config.enableWebSocketLogging) !== undefined ? config.enableWebSocketLogging : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_WEBSOCKET_LOGGING') === 'true'),
|
|
16026
|
-
logWebSocketMessages: (config === null || config === void 0 ? void 0 : config.logWebSocketMessages) !== undefined ? config.logWebSocketMessages : (getConfigValue('REACT_APP_SIGNOZ_LOG_WEBSOCKET_MESSAGES') === 'true')
|
|
16193
|
+
logWebSocketMessages: (config === null || config === void 0 ? void 0 : config.logWebSocketMessages) !== undefined ? config.logWebSocketMessages : (getConfigValue('REACT_APP_SIGNOZ_LOG_WEBSOCKET_MESSAGES') === 'true'),
|
|
16194
|
+
trackNetworkErrors: (config === null || config === void 0 ? void 0 : config.trackNetworkErrors) !== undefined ? config.trackNetworkErrors : (getConfigValue('REACT_APP_SIGNOZ_TRACK_NETWORK_ERRORS') === 'true'),
|
|
16195
|
+
ignoreNetworkErrorUrls: (config === null || config === void 0 ? void 0 : config.ignoreNetworkErrorUrls) || []
|
|
16027
16196
|
};
|
|
16028
16197
|
// Validasi konfigurasi
|
|
16029
16198
|
const { isValid, missingFields } = validateConfig(effectiveConfig);
|
|
@@ -16039,17 +16208,53 @@ function initializeSignOzTracing(config) {
|
|
|
16039
16208
|
'deployment.environment': effectiveConfig.environment,
|
|
16040
16209
|
'service.namespace': effectiveConfig.serviceNamespace,
|
|
16041
16210
|
});
|
|
16042
|
-
// Set up the OTLP trace exporter
|
|
16211
|
+
// Set up the OTLP trace exporter with error handling
|
|
16043
16212
|
const exporter = new OTLPTraceExporter({
|
|
16044
16213
|
url: effectiveConfig.url,
|
|
16045
16214
|
headers: effectiveConfig.headers,
|
|
16046
|
-
timeoutMillis:
|
|
16215
|
+
timeoutMillis: 10000 // Timeout lebih pendek (10 detik)
|
|
16047
16216
|
});
|
|
16217
|
+
// Wrap exporter to suppress timeout errors completely
|
|
16218
|
+
const originalExport = exporter.export.bind(exporter);
|
|
16219
|
+
exporter.export = function (spans, resultCallback) {
|
|
16220
|
+
// Wrap in try-catch to prevent any errors from propagating
|
|
16221
|
+
try {
|
|
16222
|
+
originalExport(spans, (result) => {
|
|
16223
|
+
// Suppress ALL errors to prevent console noise and Zone.js catching them
|
|
16224
|
+
if (result.error) {
|
|
16225
|
+
const errorMessage = String(result.error);
|
|
16226
|
+
if (errorMessage.includes('Timeout') || errorMessage.includes('timeout') || errorMessage.includes('ETIMEDOUT')) {
|
|
16227
|
+
if (effectiveConfig.enableConsoleLog) {
|
|
16228
|
+
console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
|
|
16229
|
+
}
|
|
16230
|
+
// Call callback with success to prevent error propagation
|
|
16231
|
+
resultCallback({ code: 0 });
|
|
16232
|
+
return;
|
|
16233
|
+
}
|
|
16234
|
+
// For other errors, also suppress but log if console logging is enabled
|
|
16235
|
+
if (effectiveConfig.enableConsoleLog) {
|
|
16236
|
+
console.warn('[SignOz] Span export error (suppressed):', errorMessage);
|
|
16237
|
+
}
|
|
16238
|
+
resultCallback({ code: 0 });
|
|
16239
|
+
return;
|
|
16240
|
+
}
|
|
16241
|
+
resultCallback(result);
|
|
16242
|
+
});
|
|
16243
|
+
}
|
|
16244
|
+
catch (error) {
|
|
16245
|
+
// Catch any synchronous errors and suppress them
|
|
16246
|
+
if (effectiveConfig.enableConsoleLog) {
|
|
16247
|
+
console.warn('[SignOz] Span export exception (suppressed):', error);
|
|
16248
|
+
}
|
|
16249
|
+
resultCallback({ code: 0 });
|
|
16250
|
+
}
|
|
16251
|
+
};
|
|
16048
16252
|
// Set up the span processor with configuration
|
|
16049
16253
|
const processor = new BatchSpanProcessor(exporter, {
|
|
16050
16254
|
maxQueueSize: effectiveConfig.batchSpanProcessorConfig.maxQueueSize,
|
|
16051
16255
|
scheduledDelayMillis: effectiveConfig.batchSpanProcessorConfig.scheduledDelayMillis,
|
|
16052
|
-
exportTimeoutMillis: effectiveConfig.batchSpanProcessorConfig.exportTimeoutMillis
|
|
16256
|
+
exportTimeoutMillis: effectiveConfig.batchSpanProcessorConfig.exportTimeoutMillis,
|
|
16257
|
+
maxExportBatchSize: effectiveConfig.batchSpanProcessorConfig.maxExportBatchSize
|
|
16053
16258
|
});
|
|
16054
16259
|
// Create and configure the WebTracerProvider
|
|
16055
16260
|
const provider = new WebTracerProvider({
|
|
@@ -16106,7 +16311,11 @@ function initializeSignOzTracing(config) {
|
|
|
16106
16311
|
}
|
|
16107
16312
|
// Tambahkan error tracking
|
|
16108
16313
|
if (effectiveConfig.enableErrorTracking) {
|
|
16109
|
-
addErrorTracking(
|
|
16314
|
+
addErrorTracking({
|
|
16315
|
+
enableConsoleLog: effectiveConfig.enableConsoleLog,
|
|
16316
|
+
trackNetworkErrors: effectiveConfig.trackNetworkErrors,
|
|
16317
|
+
ignoreNetworkErrorUrls: effectiveConfig.ignoreNetworkErrorUrls
|
|
16318
|
+
});
|
|
16110
16319
|
}
|
|
16111
16320
|
// Tambahkan navigation tracking
|
|
16112
16321
|
if (effectiveConfig.enableNavigationTracking) {
|
|
@@ -16134,7 +16343,8 @@ function initializeSignOzTracing(config) {
|
|
|
16134
16343
|
enableErrorTracking: effectiveConfig.enableErrorTracking,
|
|
16135
16344
|
enableNavigationTracking: effectiveConfig.enableNavigationTracking,
|
|
16136
16345
|
enableWebSocketLogging: effectiveConfig.enableWebSocketLogging,
|
|
16137
|
-
logWebSocketMessages: effectiveConfig.logWebSocketMessages
|
|
16346
|
+
logWebSocketMessages: effectiveConfig.logWebSocketMessages,
|
|
16347
|
+
trackNetworkErrors: effectiveConfig.trackNetworkErrors
|
|
16138
16348
|
});
|
|
16139
16349
|
console.log('SignOz: Tracing berhasil diinisialisasi');
|
|
16140
16350
|
}
|