@echoteam/signoz-react 1.0.5 → 1.0.6
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 +46 -10
- package/dist/index.d.ts +7 -1
- package/dist/index.esm.js +3332 -4151
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3331 -4150
- package/dist/index.js.map +1 -1
- package/dist/types/tracing.d.ts +7 -5
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -11,6 +11,13 @@ Library React untuk monitoring dan tracing aplikasi menggunakan OpenTelemetry da
|
|
|
11
11
|
- **Zero Configuration**: Mudah digunakan dengan environment variables
|
|
12
12
|
- **Customizable**: ErrorPage dan ErrorBoundary dapat dikustomisasi sesuai kebutuhan
|
|
13
13
|
|
|
14
|
+
## 📚 Dokumentasi
|
|
15
|
+
|
|
16
|
+
- [Konfigurasi CORS Backend](./BACKEND_CORS_SETUP.md) - Panduan lengkap setup CORS di berbagai framework backend
|
|
17
|
+
- [Troubleshooting](./TROUBLESHOOTING.md) - Solusi untuk masalah umum
|
|
18
|
+
- [OpenTelemetry Documentation](https://opentelemetry.io/docs/)
|
|
19
|
+
- [React Error Boundary](https://reactjs.org/docs/error-boundaries.html)
|
|
20
|
+
|
|
14
21
|
## 📦 Instalasi
|
|
15
22
|
|
|
16
23
|
```bash
|
|
@@ -31,8 +38,15 @@ REACT_APP_SIGNOZ_ENV=production
|
|
|
31
38
|
REACT_APP_SIGNOZ_SERVICE_NAMESPACE=frontend
|
|
32
39
|
REACT_APP_SIGNOZ_URL=https://your-signoz-instance.com/v1/traces
|
|
33
40
|
REACT_APP_SIGNOZ_TRACE_SAMPLE_RATE=1.0
|
|
41
|
+
REACT_APP_SIGNOZ_ALLOWED_ORIGINS=https://api1.example.com,https://api2.example.com,/^https:\/\/.*\.your-domain\.com$/
|
|
34
42
|
```
|
|
35
43
|
|
|
44
|
+
> **Catatan untuk REACT_APP_SIGNOZ_ALLOWED_ORIGINS:**
|
|
45
|
+
> - Daftar URL yang diizinkan untuk CORS, dipisahkan dengan koma
|
|
46
|
+
> - Untuk RegExp pattern, gunakan format `/pattern/` (contoh: `/^https:\/\/.*\.example\.com$/`)
|
|
47
|
+
> - Jika tidak diisi, default ke semua origin (`/.+/g`)
|
|
48
|
+
> - Spasi di sekitar koma akan dihapus otomatis
|
|
49
|
+
|
|
36
50
|
### Inisialisasi
|
|
37
51
|
|
|
38
52
|
```typescript
|
|
@@ -42,16 +56,35 @@ import { initializeSignOzTracing } from '@echoteam/signoz-react';
|
|
|
42
56
|
initializeSignOzTracing();
|
|
43
57
|
|
|
44
58
|
// Atau dengan konfigurasi manual
|
|
59
|
+
// Inisialisasi dengan konfigurasi minimal
|
|
45
60
|
initializeSignOzTracing({
|
|
46
|
-
serviceName: 'my-
|
|
61
|
+
serviceName: 'my-app',
|
|
47
62
|
serviceVersion: '1.0.0',
|
|
48
63
|
environment: 'production',
|
|
49
|
-
serviceNamespace: '
|
|
50
|
-
url: 'https://
|
|
64
|
+
serviceNamespace: 'default',
|
|
65
|
+
url: 'https://api.signoz.io/v1/traces'
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Inisialisasi dengan konfigurasi lengkap
|
|
69
|
+
initializeSignOzTracing({
|
|
70
|
+
serviceName: 'my-app',
|
|
71
|
+
serviceVersion: '1.0.0',
|
|
72
|
+
environment: 'production',
|
|
73
|
+
serviceNamespace: 'default',
|
|
74
|
+
url: 'https://api.signoz.io/v1/traces',
|
|
51
75
|
headers: {
|
|
52
|
-
'
|
|
76
|
+
'X-API-Key': 'your-api-key'
|
|
53
77
|
},
|
|
54
|
-
traceSampleRate: 0.5 // Sampling 50% trace
|
|
78
|
+
traceSampleRate: 0.5, // Sampling 50% trace
|
|
79
|
+
batchSpanProcessorConfig: {
|
|
80
|
+
maxQueueSize: 100,
|
|
81
|
+
scheduledDelayMillis: 5000,
|
|
82
|
+
exportTimeoutMillis: 30000
|
|
83
|
+
},
|
|
84
|
+
allowedOrigins: [
|
|
85
|
+
'https://api.example.com',
|
|
86
|
+
/^https:\/\/.*\.your-domain\.com$/
|
|
87
|
+
]
|
|
55
88
|
});
|
|
56
89
|
```
|
|
57
90
|
|
|
@@ -200,9 +233,13 @@ Inisialisasi SignOz tracing untuk aplikasi React.
|
|
|
200
233
|
- `environment`: Environment (production, staging, development)
|
|
201
234
|
- `serviceNamespace`: Namespace layanan
|
|
202
235
|
- `url`: URL endpoint SignOz
|
|
203
|
-
- `headers
|
|
204
|
-
- `traceSampleRate
|
|
205
|
-
|
|
236
|
+
- `headers` (opsional): Header tambahan untuk request
|
|
237
|
+
- `traceSampleRate` (opsional): Rate sampling trace (0-1, default: 1.0)
|
|
238
|
+
- `batchSpanProcessorConfig` (opsional): Konfigurasi batch processor
|
|
239
|
+
- `maxQueueSize`: Ukuran maksimum antrian span
|
|
240
|
+
- `scheduledDelayMillis`: Delay pengiriman batch dalam milidetik
|
|
241
|
+
- `exportTimeoutMillis`: Timeout ekspor dalam milidetik
|
|
242
|
+
- `allowedOrigins` (opsional): Array URL/RegExp yang diizinkan untuk CORS
|
|
206
243
|
|
|
207
244
|
### `ErrorBoundary`
|
|
208
245
|
|
|
@@ -313,5 +350,4 @@ MIT License - lihat file [LICENSE](LICENSE) untuk detail.
|
|
|
313
350
|
|
|
314
351
|
- [SignOz Documentation](https://signoz.io/docs/)
|
|
315
352
|
- [OpenTelemetry Documentation](https://opentelemetry.io/docs/)
|
|
316
|
-
- [React Error Boundary](https://reactjs.org/docs/error-boundaries.html)
|
|
317
|
-
|
|
353
|
+
- [React Error Boundary](https://reactjs.org/docs/error-boundaries.html)
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ interface SignOzConfig {
|
|
|
7
7
|
url: string;
|
|
8
8
|
headers?: Record<string, string>;
|
|
9
9
|
traceSampleRate?: number;
|
|
10
|
+
batchSpanProcessorConfig?: {
|
|
11
|
+
maxQueueSize?: number;
|
|
12
|
+
scheduledDelayMillis?: number;
|
|
13
|
+
exportTimeoutMillis?: number;
|
|
14
|
+
};
|
|
15
|
+
allowedOrigins?: (string | RegExp)[];
|
|
10
16
|
}
|
|
11
17
|
declare global {
|
|
12
18
|
interface Window {
|
|
@@ -16,12 +22,12 @@ declare global {
|
|
|
16
22
|
REACT_APP_SIGNOZ_SERVICE_NAMESPACE: string;
|
|
17
23
|
REACT_APP_SIGNOZ_URL: string;
|
|
18
24
|
REACT_APP_SIGNOZ_TRACE_SAMPLE_RATE: string;
|
|
25
|
+
REACT_APP_SIGNOZ_ALLOWED_ORIGINS: string;
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Inisialisasi SignOz tracing untuk aplikasi React
|
|
23
30
|
* @param config - Konfigurasi SignOz (opsional, akan menggunakan environment variables jika tidak disediakan)
|
|
24
|
-
* @throws {SignOzConfigurationError} Jika konfigurasi tidak valid
|
|
25
31
|
*/
|
|
26
32
|
declare function initializeSignOzTracing(config?: SignOzConfig): void;
|
|
27
33
|
|