@echoteam/signoz-react 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -234,6 +234,33 @@ Setelah setup, Anda dapat melihat traces di dashboard SignOz:
234
234
  3. **Errors**: Melihat error yang terjadi dengan stack trace
235
235
  4. **Metrics**: Melihat metrics performa aplikasi
236
236
 
237
+ ## 🚨 Troubleshooting
238
+
239
+ ### Error: Can't resolve 'perf_hooks'
240
+
241
+ Jika Anda mendapatkan error seperti ini:
242
+ ```
243
+ ERROR in ./node_modules/@echoteam/signoz-react/dist/index.esm.js 1:0-58
244
+ Module not found: Error: Can't resolve 'perf_hooks' in '/path/to/node_modules/@echoteam/signoz-react/dist'
245
+ ```
246
+
247
+ **Solusi:**
248
+ Library ini sudah diperbaiki untuk menangani masalah ini. Pastikan Anda menggunakan versi terbaru:
249
+
250
+ ```bash
251
+ yarn add @echoteam/signoz-react@latest
252
+ ```
253
+
254
+ Jika masih mengalami masalah, lihat [TROUBLESHOOTING.md](TROUBLESHOOTING.md) untuk solusi lengkap berdasarkan bundler yang Anda gunakan (Webpack, Vite, Create React App).
255
+
256
+ ### Masalah Umum Lainnya
257
+
258
+ 1. **Environment Variables Tidak Terdeteksi**: Pastikan semua environment variables sudah dikonfigurasi dengan benar
259
+ 2. **CORS Error**: Pastikan URL SignOz dapat diakses dari domain aplikasi Anda
260
+ 3. **Network Error**: Periksa koneksi internet dan firewall settings
261
+
262
+ Untuk informasi troubleshooting lebih lengkap, lihat [TROUBLESHOOTING.md](TROUBLESHOOTING.md).
263
+
237
264
  ## 🛠️ Development
238
265
 
239
266
  ### Setup Development
@@ -0,0 +1,186 @@
1
+ # Troubleshooting Guide
2
+
3
+ ## Error: Can't resolve 'perf_hooks'
4
+
5
+ ### Masalah
6
+ Jika Anda mendapatkan error seperti ini:
7
+ ```
8
+ ERROR in ./node_modules/@echoteam/signoz-react/dist/index.esm.js 1:0-58
9
+ Module not found: Error: Can't resolve 'perf_hooks' in '/path/to/node_modules/@echoteam/signoz-react/dist'
10
+ ```
11
+
12
+ ### Penyebab
13
+ Error ini terjadi karena library OpenTelemetry mencoba mengimpor modul Node.js (`perf_hooks`) yang tidak tersedia di browser. Library ini dirancang untuk berjalan di browser, bukan di Node.js.
14
+
15
+ ### Solusi
16
+
17
+ #### 1. Pastikan menggunakan versi terbaru
18
+ Library ini sudah diperbaiki untuk menangani masalah ini. Pastikan Anda menggunakan versi terbaru:
19
+
20
+ ```bash
21
+ yarn add @echoteam/signoz-react@latest
22
+ ```
23
+
24
+ #### 2. Konfigurasi Webpack (jika menggunakan Webpack)
25
+ Tambahkan konfigurasi berikut di `webpack.config.js`:
26
+
27
+ ```javascript
28
+ module.exports = {
29
+ // ... konfigurasi lainnya
30
+ resolve: {
31
+ fallback: {
32
+ "perf_hooks": false,
33
+ "fs": false,
34
+ "path": false,
35
+ "os": false,
36
+ "crypto": false,
37
+ "stream": false,
38
+ "util": false,
39
+ "events": false,
40
+ "assert": false,
41
+ "buffer": false,
42
+ "querystring": false,
43
+ "url": false,
44
+ "http": false,
45
+ "https": false,
46
+ "zlib": false,
47
+ "tty": false,
48
+ "domain": false,
49
+ "dns": false,
50
+ "dgram": false,
51
+ "child_process": false,
52
+ "cluster": false,
53
+ "module": false,
54
+ "net": false,
55
+ "readline": false,
56
+ "repl": false,
57
+ "string_decoder": false,
58
+ "sys": false,
59
+ "timers": false,
60
+ "tls": false,
61
+ "v8": false,
62
+ "vm": false,
63
+ "worker_threads": false
64
+ }
65
+ }
66
+ };
67
+ ```
68
+
69
+ #### 3. Konfigurasi Vite (jika menggunakan Vite)
70
+ Tambahkan konfigurasi berikut di `vite.config.js`:
71
+
72
+ ```javascript
73
+ import { defineConfig } from 'vite';
74
+
75
+ export default defineConfig({
76
+ // ... konfigurasi lainnya
77
+ define: {
78
+ global: 'globalThis',
79
+ },
80
+ resolve: {
81
+ alias: {
82
+ 'perf_hooks': false,
83
+ 'fs': false,
84
+ 'path': false,
85
+ 'os': false,
86
+ 'crypto': false,
87
+ 'stream': false,
88
+ 'util': false,
89
+ 'events': false,
90
+ 'assert': false,
91
+ 'buffer': false,
92
+ 'querystring': false,
93
+ 'url': false,
94
+ 'http': false,
95
+ 'https': false,
96
+ 'zlib': false,
97
+ 'tty': false,
98
+ 'domain': false,
99
+ 'dns': false,
100
+ 'dgram': false,
101
+ 'child_process': false,
102
+ 'cluster': false,
103
+ 'module': false,
104
+ 'net': false,
105
+ 'readline': false,
106
+ 'repl': false,
107
+ 'string_decoder': false,
108
+ 'sys': false,
109
+ 'timers': false,
110
+ 'tls': false,
111
+ 'v8': false,
112
+ 'vm': false,
113
+ 'worker_threads': false
114
+ }
115
+ }
116
+ });
117
+ ```
118
+
119
+ #### 4. Konfigurasi Create React App
120
+ Jika menggunakan Create React App, Anda mungkin perlu menggunakan `react-app-rewired` untuk mengoverride konfigurasi webpack:
121
+
122
+ 1. Install react-app-rewired:
123
+ ```bash
124
+ yarn add --dev react-app-rewired
125
+ ```
126
+
127
+ 2. Buat file `config-overrides.js` di root proyek:
128
+ ```javascript
129
+ module.exports = function override(config, env) {
130
+ config.resolve.fallback = {
131
+ ...config.resolve.fallback,
132
+ "perf_hooks": false,
133
+ "fs": false,
134
+ "path": false,
135
+ "os": false,
136
+ "crypto": false,
137
+ "stream": false,
138
+ "util": false,
139
+ "events": false,
140
+ "assert": false,
141
+ "buffer": false,
142
+ "querystring": false,
143
+ "url": false,
144
+ "http": false,
145
+ "https": false,
146
+ "zlib": false,
147
+ "tty": false,
148
+ "domain": false,
149
+ "dns": false,
150
+ "dgram": false,
151
+ "child_process": false,
152
+ "cluster": false,
153
+ "module": false,
154
+ "net": false,
155
+ "readline": false,
156
+ "repl": false,
157
+ "string_decoder": false,
158
+ "sys": false,
159
+ "timers": false,
160
+ "tls": false,
161
+ "v8": false,
162
+ "vm": false,
163
+ "worker_threads": false
164
+ };
165
+ return config;
166
+ };
167
+ ```
168
+
169
+ 3. Update script di `package.json`:
170
+ ```json
171
+ {
172
+ "scripts": {
173
+ "start": "react-app-rewired start",
174
+ "build": "react-app-rewired build",
175
+ "test": "react-app-rewired test"
176
+ }
177
+ }
178
+ ```
179
+
180
+ ### Catatan Penting
181
+ - Library ini dirancang untuk berjalan di browser, bukan di Node.js
182
+ - Polyfill sudah disertakan untuk menangani modul Node.js yang tidak tersedia di browser
183
+ - Pastikan environment variables untuk SignOz sudah dikonfigurasi dengan benar
184
+
185
+ ### Masalah Lainnya
186
+ Jika Anda masih mengalami masalah, silakan buat issue di repository ini dengan detail error yang lengkap.