@tracelog/lib 0.11.5 → 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 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;