@tracelog/lib 0.11.4 → 0.12.0
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 +60 -5
- package/dist/browser/tracelog.esm.js +708 -644
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/public-api.cjs +101 -18
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.d.mts +121 -64
- package/dist/public-api.d.ts +121 -64
- package/dist/public-api.js +96 -17
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,6 +83,13 @@ await tracelog.init({
|
|
|
83
83
|
// Privacy
|
|
84
84
|
sensitiveQueryParams: ['token'], // Merged with defaults
|
|
85
85
|
|
|
86
|
+
// Web Vitals filtering (controls which performance metrics are tracked)
|
|
87
|
+
webVitalsMode: 'needs-improvement', // 'all' | 'needs-improvement' | 'poor' (default: 'needs-improvement')
|
|
88
|
+
webVitalsThresholds: { // Optional: override default thresholds
|
|
89
|
+
LCP: 3000, // Custom threshold in milliseconds
|
|
90
|
+
FCP: 2000
|
|
91
|
+
},
|
|
92
|
+
|
|
86
93
|
// Integrations
|
|
87
94
|
integrations: {
|
|
88
95
|
tracelog: { projectId: 'your-id' },
|
|
@@ -164,6 +171,44 @@ tracelog.on('event', (event) => {
|
|
|
164
171
|
});
|
|
165
172
|
```
|
|
166
173
|
|
|
174
|
+
### Web Vitals Filtering
|
|
175
|
+
```typescript
|
|
176
|
+
// Default: Track metrics needing improvement or worse (balanced approach)
|
|
177
|
+
await tracelog.init({
|
|
178
|
+
webVitalsMode: 'needs-improvement'
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Track all metrics (for full trend analysis and P75 calculations)
|
|
182
|
+
await tracelog.init({
|
|
183
|
+
webVitalsMode: 'all'
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Track only poor metrics (minimize data volume)
|
|
187
|
+
await tracelog.init({
|
|
188
|
+
webVitalsMode: 'poor'
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Custom thresholds (fine-grained control)
|
|
192
|
+
await tracelog.init({
|
|
193
|
+
webVitalsMode: 'needs-improvement',
|
|
194
|
+
webVitalsThresholds: {
|
|
195
|
+
LCP: 3000, // Stricter than default 2500ms
|
|
196
|
+
FCP: 2500, // Stricter than default 1800ms
|
|
197
|
+
CLS: 0.15 // Stricter than default 0.1
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Threshold Reference (Core Web Vitals standards):**
|
|
203
|
+
|
|
204
|
+
| Metric | 'all' | 'needs-improvement' (default) | 'poor' |
|
|
205
|
+
|--------|-------|-------------------------------|--------|
|
|
206
|
+
| LCP | Track all | > 2500ms | > 4000ms |
|
|
207
|
+
| FCP | Track all | > 1800ms | > 3000ms |
|
|
208
|
+
| CLS | Track all | > 0.1 | > 0.25 |
|
|
209
|
+
| INP | Track all | > 200ms | > 500ms |
|
|
210
|
+
| TTFB | Track all | > 800ms | > 1800ms |
|
|
211
|
+
|
|
167
212
|
### Global Disable
|
|
168
213
|
```typescript
|
|
169
214
|
window.__traceLogDisabled = true;
|
|
@@ -184,12 +229,22 @@ window.__traceLogDisabled = true;
|
|
|
184
229
|
|
|
185
230
|
[Full Security Guide →](./SECURITY.md)
|
|
186
231
|
|
|
187
|
-
## Error Handling
|
|
232
|
+
## Error Handling & Reliability
|
|
233
|
+
|
|
234
|
+
TraceLog uses a **persistence-based recovery model** with no in-session retries:
|
|
235
|
+
|
|
236
|
+
- **Success (2xx)** - Events sent immediately, queue cleared
|
|
237
|
+
- **Permanent errors (4xx)** - Events discarded immediately (invalid data won't succeed on retry)
|
|
238
|
+
- **Temporary errors (5xx/network)** - Events removed from queue and persisted to localStorage
|
|
239
|
+
- **Recovery** - Persisted events automatically recovered and retried on next page load
|
|
240
|
+
- **Expiration** - Persisted events expire after 2 hours
|
|
241
|
+
- **Page unload** - Uses `sendBeacon()` for synchronous delivery of session end events
|
|
188
242
|
|
|
189
|
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
243
|
+
**Why no in-session retries?**
|
|
244
|
+
- Prevents infinite retry loops during API outages
|
|
245
|
+
- Reduces server load and network traffic during failures
|
|
246
|
+
- Better battery life on mobile devices
|
|
247
|
+
- Natural recovery on page navigation (common in SPAs)
|
|
193
248
|
|
|
194
249
|
## Debug
|
|
195
250
|
|