@echoteam/signoz-react 1.2.8 → 1.2.11
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 +76 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +30 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -2
- package/dist/index.js.map +1 -1
- package/dist/types/tracing.d.ts +1 -0
- package/package.json +1 -1
package/TROUBLESHOOTING.md
CHANGED
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# Troubleshooting Guide
|
|
2
2
|
|
|
3
|
+
## Error: Timeout from BatchSpanProcessor
|
|
4
|
+
|
|
5
|
+
### Masalah
|
|
6
|
+
Jika Anda mendapatkan error seperti ini di console:
|
|
7
|
+
```
|
|
8
|
+
Unhandled Promise rejection: Timeout ; Zone: <root> ; Task: Promise.then ; Value: Error: Timeout
|
|
9
|
+
at BatchSpanProcessorBase.js:132:1
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Penyebab
|
|
13
|
+
Error ini terjadi ketika BatchSpanProcessor mencoba mengirim spans ke backend SignOz tetapi mengalami timeout. Ini biasanya terjadi karena:
|
|
14
|
+
1. Backend SignOz tidak dapat dijangkau
|
|
15
|
+
2. Network lambat atau tidak stabil
|
|
16
|
+
3. CORS tidak dikonfigurasi dengan benar di backend
|
|
17
|
+
4. Timeout terlalu pendek untuk koneksi Anda
|
|
18
|
+
|
|
19
|
+
### Solusi
|
|
20
|
+
|
|
21
|
+
#### 1. Verifikasi Backend SignOz Dapat Dijangkau
|
|
22
|
+
Pastikan URL SignOz Anda benar dan dapat diakses dari browser:
|
|
23
|
+
```javascript
|
|
24
|
+
// Test di browser console
|
|
25
|
+
fetch('http://your-signoz-url:4318/v1/traces', {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: { 'Content-Type': 'application/json' }
|
|
28
|
+
})
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### 2. Periksa CORS Configuration
|
|
32
|
+
Pastikan backend SignOz Anda mengizinkan request dari domain frontend Anda. Lihat [BACKEND_CORS_SETUP.md](./BACKEND_CORS_SETUP.md) untuk panduan lengkap.
|
|
33
|
+
|
|
34
|
+
#### 3. Tingkatkan Timeout (Recommended)
|
|
35
|
+
Sejak versi 1.2.10, timeout default sudah ditingkatkan menjadi 60 detik. Jika masih timeout, Anda bisa meningkatkannya lebih lanjut:
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
import { initializeSignOzTracing } from '@echoteam/signoz-react';
|
|
39
|
+
|
|
40
|
+
initializeSignOzTracing({
|
|
41
|
+
serviceName: 'my-app',
|
|
42
|
+
serviceVersion: '1.0.0',
|
|
43
|
+
environment: 'production',
|
|
44
|
+
serviceNamespace: 'frontend',
|
|
45
|
+
url: 'http://your-signoz-url:4318/v1/traces',
|
|
46
|
+
batchSpanProcessorConfig: {
|
|
47
|
+
maxQueueSize: 100,
|
|
48
|
+
scheduledDelayMillis: 5000,
|
|
49
|
+
exportTimeoutMillis: 120000, // 120 seconds
|
|
50
|
+
maxExportBatchSize: 50
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### 4. Suppress Timeout Errors (Jika Tidak Mengganggu)
|
|
56
|
+
Sejak versi 1.2.10, timeout errors dari BatchSpanProcessor secara otomatis di-suppress untuk menghindari noise di console. Error ini biasanya aman untuk diabaikan karena spans akan di-retry atau di-queue ulang.
|
|
57
|
+
|
|
58
|
+
Jika Anda ingin melihat warning untuk timeout ini, aktifkan console logging:
|
|
59
|
+
```javascript
|
|
60
|
+
initializeSignOzTracing({
|
|
61
|
+
// ... config lainnya
|
|
62
|
+
enableConsoleLog: true
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### 5. Gunakan Network yang Lebih Stabil
|
|
67
|
+
Jika Anda mengalami timeout secara konsisten, pertimbangkan:
|
|
68
|
+
- Menggunakan koneksi internet yang lebih stabil
|
|
69
|
+
- Mengurangi ukuran batch dengan `maxExportBatchSize`
|
|
70
|
+
- Meningkatkan `scheduledDelayMillis` untuk mengirim spans lebih jarang
|
|
71
|
+
|
|
72
|
+
### Catatan Penting
|
|
73
|
+
- Timeout errors biasanya tidak mempengaruhi fungsionalitas aplikasi Anda
|
|
74
|
+
- Spans yang gagal dikirim akan di-queue ulang dan dicoba lagi
|
|
75
|
+
- Jika backend SignOz tidak dapat dijangkau sama sekali, spans akan di-drop setelah queue penuh
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
3
79
|
## Error: Can't resolve 'perf_hooks'
|
|
4
80
|
|
|
5
81
|
### Masalah
|
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -15584,6 +15584,21 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15584
15584
|
}, true); // Use capture phase to catch errors early
|
|
15585
15585
|
// Track unhandled promise rejections
|
|
15586
15586
|
window.addEventListener('unhandledrejection', (event) => {
|
|
15587
|
+
// Suppress BatchSpanProcessor timeout errors to avoid noise
|
|
15588
|
+
const reason = String(event.reason);
|
|
15589
|
+
const stack = event.reason instanceof Error ? (event.reason.stack || '') : '';
|
|
15590
|
+
// Check if this is a SignOz internal timeout error
|
|
15591
|
+
const isSignOzTimeout = (reason.includes('Timeout') &&
|
|
15592
|
+
(reason.includes('BatchSpanProcessor') ||
|
|
15593
|
+
stack.includes('BatchSpanProcessor') ||
|
|
15594
|
+
stack.includes('zone.js')));
|
|
15595
|
+
if (isSignOzTimeout) {
|
|
15596
|
+
if (enableConsoleLog) {
|
|
15597
|
+
console.warn('[SignOz] Span export timeout (this is usually safe to ignore - check if SignOz endpoint is reachable)');
|
|
15598
|
+
}
|
|
15599
|
+
event.preventDefault(); // Prevent the error from being logged
|
|
15600
|
+
return;
|
|
15601
|
+
}
|
|
15587
15602
|
const tracer = trace.getTracer('error-tracker');
|
|
15588
15603
|
const span = tracer.startSpan('Unhandled Promise Rejection');
|
|
15589
15604
|
span.setAttribute('error.type', 'unhandled_rejection');
|
|
@@ -15611,6 +15626,17 @@ function addErrorTracking(enableConsoleLog = false) {
|
|
|
15611
15626
|
const originalHandleError = currentZone.handleError;
|
|
15612
15627
|
if (originalHandleError) {
|
|
15613
15628
|
currentZone.handleError = function (error) {
|
|
15629
|
+
// Skip SignOz internal timeout errors
|
|
15630
|
+
const errorMessage = error.message || String(error);
|
|
15631
|
+
const errorStack = error.stack || '';
|
|
15632
|
+
const isSignOzTimeout = (errorMessage.includes('Timeout') &&
|
|
15633
|
+
(errorStack.includes('BatchSpanProcessor') || errorStack.includes('zone.js')));
|
|
15634
|
+
if (isSignOzTimeout) {
|
|
15635
|
+
if (enableConsoleLog) {
|
|
15636
|
+
console.warn('[SignOz] Zone.js caught span export timeout (safe to ignore)');
|
|
15637
|
+
}
|
|
15638
|
+
return; // Don't track this error
|
|
15639
|
+
}
|
|
15614
15640
|
const tracer = trace.getTracer('error-tracker');
|
|
15615
15641
|
const span = tracer.startSpan('Zone.js Error');
|
|
15616
15642
|
span.setAttribute('error.type', 'zone_error');
|
|
@@ -15984,7 +16010,8 @@ function initializeSignOzTracing(config) {
|
|
|
15984
16010
|
batchSpanProcessorConfig: (config === null || config === void 0 ? void 0 : config.batchSpanProcessorConfig) || {
|
|
15985
16011
|
maxQueueSize: 100,
|
|
15986
16012
|
scheduledDelayMillis: 5000,
|
|
15987
|
-
exportTimeoutMillis:
|
|
16013
|
+
exportTimeoutMillis: 60000, // Increased to 60 seconds
|
|
16014
|
+
maxExportBatchSize: 50 // Smaller batches to avoid timeouts
|
|
15988
16015
|
},
|
|
15989
16016
|
allowedOrigins: (config === null || config === void 0 ? void 0 : config.allowedOrigins) || parseAllowedOrigins(getConfigValue('REACT_APP_SIGNOZ_ALLOWED_ORIGINS')),
|
|
15990
16017
|
enableRequestLogging: (config === null || config === void 0 ? void 0 : config.enableRequestLogging) !== undefined ? config.enableRequestLogging : (getConfigValue('REACT_APP_SIGNOZ_ENABLE_REQUEST_LOGGING') === 'true' || true),
|
|
@@ -16015,7 +16042,8 @@ function initializeSignOzTracing(config) {
|
|
|
16015
16042
|
// Set up the OTLP trace exporter
|
|
16016
16043
|
const exporter = new OTLPTraceExporter({
|
|
16017
16044
|
url: effectiveConfig.url,
|
|
16018
|
-
headers: effectiveConfig.headers
|
|
16045
|
+
headers: effectiveConfig.headers,
|
|
16046
|
+
timeoutMillis: 60000 // Set exporter timeout to 60 seconds
|
|
16019
16047
|
});
|
|
16020
16048
|
// Set up the span processor with configuration
|
|
16021
16049
|
const processor = new BatchSpanProcessor(exporter, {
|