@echoteam/signoz-react 1.2.10 → 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/TROUBLESHOOTING.md +92 -13
- package/dist/index.esm.js +67 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +67 -7
- package/dist/index.js.map +1 -1
- 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.esm.js
CHANGED
|
@@ -15551,7 +15551,22 @@ function addXHRLogging(config) {
|
|
|
15551
15551
|
function addErrorTracking(enableConsoleLog = false) {
|
|
15552
15552
|
// Track unhandled errors
|
|
15553
15553
|
window.addEventListener('error', (event) => {
|
|
15554
|
-
var _a;
|
|
15554
|
+
var _a, _b;
|
|
15555
|
+
// Skip SignOz internal timeout errors
|
|
15556
|
+
const errorMessage = event.message || '';
|
|
15557
|
+
const errorStack = ((_a = event.error) === null || _a === void 0 ? void 0 : _a.stack) || '';
|
|
15558
|
+
const isSignOzTimeout = (errorMessage.includes('Timeout') &&
|
|
15559
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
15560
|
+
errorStack.includes('BatchSpanProcessor') ||
|
|
15561
|
+
errorStack.includes('zone.js') ||
|
|
15562
|
+
errorStack.includes('SignOz')));
|
|
15563
|
+
if (isSignOzTimeout) {
|
|
15564
|
+
if (enableConsoleLog) {
|
|
15565
|
+
console.warn('[SignOz] Span export timeout detected (safe to ignore - not tracking this error)');
|
|
15566
|
+
}
|
|
15567
|
+
event.preventDefault(); // Prevent the error from propagating
|
|
15568
|
+
return;
|
|
15569
|
+
}
|
|
15555
15570
|
const tracer = trace.getTracer('error-tracker');
|
|
15556
15571
|
const span = tracer.startSpan('Unhandled Error');
|
|
15557
15572
|
span.setAttribute('error.type', 'unhandled');
|
|
@@ -15576,7 +15591,7 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15576
15591
|
filename: event.filename,
|
|
15577
15592
|
lineno: event.lineno,
|
|
15578
15593
|
colno: event.colno,
|
|
15579
|
-
stack: (
|
|
15594
|
+
stack: (_b = event.error) === null || _b === void 0 ? void 0 : _b.stack,
|
|
15580
15595
|
page: window.location.pathname
|
|
15581
15596
|
});
|
|
15582
15597
|
}
|
|
@@ -15586,9 +15601,15 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15586
15601
|
window.addEventListener('unhandledrejection', (event) => {
|
|
15587
15602
|
// Suppress BatchSpanProcessor timeout errors to avoid noise
|
|
15588
15603
|
const reason = String(event.reason);
|
|
15589
|
-
|
|
15604
|
+
const stack = event.reason instanceof Error ? (event.reason.stack || '') : '';
|
|
15605
|
+
// Check if this is a SignOz internal timeout error
|
|
15606
|
+
const isSignOzTimeout = (reason.includes('Timeout') &&
|
|
15607
|
+
(reason.includes('BatchSpanProcessor') ||
|
|
15608
|
+
stack.includes('BatchSpanProcessor') ||
|
|
15609
|
+
stack.includes('zone.js')));
|
|
15610
|
+
if (isSignOzTimeout) {
|
|
15590
15611
|
if (enableConsoleLog) {
|
|
15591
|
-
console.warn('[SignOz] Span export timeout (this is usually safe to ignore)
|
|
15612
|
+
console.warn('[SignOz] Span export timeout (this is usually safe to ignore - check if SignOz endpoint is reachable)');
|
|
15592
15613
|
}
|
|
15593
15614
|
event.preventDefault(); // Prevent the error from being logged
|
|
15594
15615
|
return;
|
|
@@ -15620,6 +15641,17 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15620
15641
|
const originalHandleError = currentZone.handleError;
|
|
15621
15642
|
if (originalHandleError) {
|
|
15622
15643
|
currentZone.handleError = function (error) {
|
|
15644
|
+
// Skip SignOz internal timeout errors
|
|
15645
|
+
const errorMessage = error.message || String(error);
|
|
15646
|
+
const errorStack = error.stack || '';
|
|
15647
|
+
const isSignOzTimeout = (errorMessage.includes('Timeout') &&
|
|
15648
|
+
(errorStack.includes('BatchSpanProcessor') || errorStack.includes('zone.js')));
|
|
15649
|
+
if (isSignOzTimeout) {
|
|
15650
|
+
if (enableConsoleLog) {
|
|
15651
|
+
console.warn('[SignOz] Zone.js caught span export timeout (safe to ignore)');
|
|
15652
|
+
}
|
|
15653
|
+
return; // Don't track this error
|
|
15654
|
+
}
|
|
15623
15655
|
const tracer = trace.getTracer('error-tracker');
|
|
15624
15656
|
const span = tracer.startSpan('Zone.js Error');
|
|
15625
15657
|
span.setAttribute('error.type', 'zone_error');
|
|
@@ -15649,6 +15681,15 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15649
15681
|
console.error = function (...args) {
|
|
15650
15682
|
// Check if this is a React error
|
|
15651
15683
|
const errorMessage = args.map(arg => String(arg)).join(' ');
|
|
15684
|
+
// Skip SignOz internal errors
|
|
15685
|
+
const isSignOzError = (errorMessage.includes('Timeout') &&
|
|
15686
|
+
(errorMessage.includes('BatchSpanProcessor') ||
|
|
15687
|
+
errorMessage.includes('zone.js') ||
|
|
15688
|
+
errorMessage.includes('SignOz')));
|
|
15689
|
+
if (isSignOzError) {
|
|
15690
|
+
// Just call original console.error without tracking
|
|
15691
|
+
return originalConsoleError.apply(console, args);
|
|
15692
|
+
}
|
|
15652
15693
|
if (errorMessage.includes('React') || errorMessage.includes('TypeError') || errorMessage.includes('Uncaught')) {
|
|
15653
15694
|
const tracer = trace.getTracer('error-tracker');
|
|
15654
15695
|
const span = tracer.startSpan('Console Error');
|
|
@@ -15993,7 +16034,7 @@ function initializeSignOzTracing(config) {
|
|
|
15993
16034
|
batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
|
|
15994
16035
|
maxQueueSize: 100,
|
|
15995
16036
|
scheduledDelayMillis: 5000,
|
|
15996
|
-
exportTimeoutMillis:
|
|
16037
|
+
exportTimeoutMillis: 30000, // Reduced to 30 seconds to fail faster
|
|
15997
16038
|
maxExportBatchSize: 50 // Smaller batches to avoid timeouts
|
|
15998
16039
|
},
|
|
15999
16040
|
allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
|
|
@@ -16022,12 +16063,31 @@ function initializeSignOzTracing(config) {
|
|
|
16022
16063
|
'deployment.environment': effectiveConfig.environment,
|
|
16023
16064
|
'service.namespace': effectiveConfig.serviceNamespace,
|
|
16024
16065
|
});
|
|
16025
|
-
// Set up the OTLP trace exporter
|
|
16066
|
+
// Set up the OTLP trace exporter with error handling
|
|
16026
16067
|
const exporter = new OTLPTraceExporter({
|
|
16027
16068
|
url: effectiveConfig.url,
|
|
16028
16069
|
headers: effectiveConfig.headers,
|
|
16029
|
-
timeoutMillis:
|
|
16070
|
+
timeoutMillis: 30000 // Reduced to 30 seconds to fail faster
|
|
16030
16071
|
});
|
|
16072
|
+
// Wrap exporter to suppress timeout errors
|
|
16073
|
+
const originalExport = exporter.export.bind(exporter);
|
|
16074
|
+
exporter.export = function (spans, resultCallback) {
|
|
16075
|
+
originalExport(spans, (result) => {
|
|
16076
|
+
// Suppress timeout errors to prevent console noise
|
|
16077
|
+
if (result.error) {
|
|
16078
|
+
const errorMessage = String(result.error);
|
|
16079
|
+
if (errorMessage.includes('Timeout') || errorMessage.includes('timeout')) {
|
|
16080
|
+
if (effectiveConfig.enableConsoleLog) {
|
|
16081
|
+
console.warn('[SignOz] Span export timeout - check if SignOz endpoint is reachable:', effectiveConfig.url);
|
|
16082
|
+
}
|
|
16083
|
+
// Call callback with success to prevent error propagation
|
|
16084
|
+
resultCallback({ code: 0 });
|
|
16085
|
+
return;
|
|
16086
|
+
}
|
|
16087
|
+
}
|
|
16088
|
+
resultCallback(result);
|
|
16089
|
+
});
|
|
16090
|
+
};
|
|
16031
16091
|
// Set up the span processor with configuration
|
|
16032
16092
|
const processor = new BatchSpanProcessor(exporter, {
|
|
16033
16093
|
maxQueueSize: effectiveConfig.batchSpanProcessorConfig.maxQueueSize,
|