@echoteam/signoz-react 1.2.11 → 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 +48 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +48 -5
- 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
|
}
|
|
@@ -15666,6 +15681,15 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15666
15681
|
console.error = function (...args) {
|
|
15667
15682
|
// Check if this is a React error
|
|
15668
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
|
+
}
|
|
15669
15693
|
if (errorMessage.includes('React') || errorMessage.includes('TypeError') || errorMessage.includes('Uncaught')) {
|
|
15670
15694
|
const tracer = trace.getTracer('error-tracker');
|
|
15671
15695
|
const span = tracer.startSpan('Console Error');
|
|
@@ -16010,7 +16034,7 @@ function initializeSignOzTracing(config) {
|
|
|
16010
16034
|
batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
|
|
16011
16035
|
maxQueueSize: 100,
|
|
16012
16036
|
scheduledDelayMillis: 5000,
|
|
16013
|
-
exportTimeoutMillis:
|
|
16037
|
+
exportTimeoutMillis: 30000, // Reduced to 30 seconds to fail faster
|
|
16014
16038
|
maxExportBatchSize: 50 // Smaller batches to avoid timeouts
|
|
16015
16039
|
},
|
|
16016
16040
|
allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
|
|
@@ -16039,12 +16063,31 @@ function initializeSignOzTracing(config) {
|
|
|
16039
16063
|
'deployment.environment': effectiveConfig.environment,
|
|
16040
16064
|
'service.namespace': effectiveConfig.serviceNamespace,
|
|
16041
16065
|
});
|
|
16042
|
-
// Set up the OTLP trace exporter
|
|
16066
|
+
// Set up the OTLP trace exporter with error handling
|
|
16043
16067
|
const exporter = new OTLPTraceExporter({
|
|
16044
16068
|
url: effectiveConfig.url,
|
|
16045
16069
|
headers: effectiveConfig.headers,
|
|
16046
|
-
timeoutMillis:
|
|
16070
|
+
timeoutMillis: 30000 // Reduced to 30 seconds to fail faster
|
|
16047
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
|
+
};
|
|
16048
16091
|
// Set up the span processor with configuration
|
|
16049
16092
|
const processor = new BatchSpanProcessor(exporter, {
|
|
16050
16093
|
maxQueueSize: effectiveConfig.batchSpanProcessorConfig.maxQueueSize,
|