autotel-web 1.9.0 → 1.10.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.
Files changed (2) hide show
  1. package/README.md +8 -8
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -4,7 +4,7 @@ Ultra-lightweight browser SDK for distributed tracing (**1.6KB gzipped**)
4
4
 
5
5
  **Purpose:** Enable distributed tracing between browser and backend applications. The browser propagates W3C `traceparent` headers, and your backend (using [Autotel](../autotel)) automatically continues the trace.
6
6
 
7
- **Core Philosophy:** The backend does all the real tracing timing, spans, errors, export while the browser only propagates the trace context via headers.
7
+ **Core Philosophy:** The backend does all the real tracing : timing, spans, errors, export : while the browser only propagates the trace context via headers.
8
8
 
9
9
  **No OpenTelemetry dependencies. No exporters. No collectors. No CORS. Just header injection.**
10
10
 
@@ -38,8 +38,8 @@ yarn add autotel-web
38
38
 
39
39
  ### Lean vs Full mode
40
40
 
41
- - **Lean (default)** `import { init } from 'autotel-web'`. Zero dependencies, ~1.6KB gzipped. Only injects W3C `traceparent` on fetch/XHR; no real spans in the browser. Backend does the real tracing.
42
- - **Full** `import { initFull } from 'autotel-web/full'`. Real spans (navigation, fetch/XHR, optional user interaction), optional `http.client.network_timing` events, **Web Vitals** (LCP, INP, CLS, FCP, TTFB), **unhandled error capture**, optional long-task capture, sampling, and OTLP export. No Zone.js; bundle size is larger (~4050KB gzipped). Use when you need client-side spans and export from the browser.
41
+ - **Lean (default)** : `import { init } from 'autotel-web'`. Zero dependencies, ~1.6KB gzipped. Only injects W3C `traceparent` on fetch/XHR; no real spans in the browser. Backend does the real tracing.
42
+ - **Full**: `import { initFull } from 'autotel-web/full'`. Real spans (navigation, fetch/XHR, optional user interaction), optional `http.client.network_timing` events, **Web Vitals** (LCP, INP, CLS, FCP, TTFB), **unhandled error capture**, optional long-task capture, sampling, and OTLP export. No Zone.js; bundle size is larger (~40-50KB gzipped). Use when you need client-side spans and export from the browser.
43
43
 
44
44
  Use lean mode by default; use full mode when you need real browser spans and network timing. You can use dynamic import to load full mode only when needed: `import('autotel-web/full').then(({ initFull }) => initFull(config))`.
45
45
 
@@ -395,7 +395,7 @@ interface AutotelWebFullConfig {
395
395
  service: string
396
396
  endpoint?: string // OTLP traces URL (e.g. https://api.example.com/v1/traces)
397
397
  spanProcessor?: SpanProcessor // Custom processor instead of endpoint
398
- sampleRate?: number // 01, e.g. 0.1 in production
398
+ sampleRate?: number // 0-1, e.g. 0.1 in production
399
399
  sampler?: Sampler // Custom sampler (overrides sampleRate)
400
400
  captureNavigation?: boolean // default true
401
401
  captureFetch?: boolean // default true
@@ -838,7 +838,7 @@ export default function MyComponent() { ... }
838
838
  ## Bundle Size
839
839
 
840
840
  - **Lean mode** (`autotel-web`): **~1.6KB gzipped**. Zero dependencies. Pure JavaScript using native `crypto.getRandomValues()`.
841
- - **Full mode** (`autotel-web/full`): ~4050KB gzipped (includes OpenTelemetry SDK and instrumentations). No Zone.js. Use when you need real spans and export from the browser.
841
+ - **Full mode** (`autotel-web/full`): ~40-50KB gzipped (includes OpenTelemetry SDK and instrumentations). No Zone.js. Use when you need real spans and export from the browser.
842
842
 
843
843
  ## Architecture: Header-Only Approach
844
844
 
@@ -918,7 +918,7 @@ autotel-web has **effectively zero performance overhead**:
918
918
 
919
919
  ## Context Propagation Without Zone.js
920
920
 
921
- Browser tracing with OpenTelemetry typically needs **context propagation**: when you start a span (e.g., "user clicked button"), any async work that followsfetch, setTimeout, Promise chainsshould run in that same trace context so the backend sees one continuous trace. In Node.js, OpenTelemetry uses AsyncLocalStorage to keep context across async boundaries. In the browser, there is no built-in "async context" that follows every boundary. **Zone.js** is the usual way to get that: it patches globals (setTimeout, Promise, fetch, etc.) so that any code that runs "later" still runs inside the same zoneand thus the same trace context.
921
+ Browser tracing with OpenTelemetry typically needs **context propagation**: when you start a span (e.g., "user clicked button"), any async work that follows: fetch, setTimeout, Promise chains: should run in that same trace context so the backend sees one continuous trace. In Node.js, OpenTelemetry uses AsyncLocalStorage to keep context across async boundaries. In the browser, there is no built-in "async context" that follows every boundary. **Zone.js** is the usual way to get that: it patches globals (setTimeout, Promise, fetch, etc.) so that any code that runs "later" still runs inside the same zone: and thus the same trace context.
922
922
 
923
923
  This section explains when you might need Zone.js, its pitfalls, and how autotel-web gets you reliable tracing without it.
924
924
 
@@ -926,7 +926,7 @@ This section explains when you might need Zone.js, its pitfalls, and how autotel
926
926
 
927
927
  You might think you need **async context that survives every boundary** when:
928
928
 
929
- - You start a span in one place (e.g., click handler) and want **all** follow-up worknested setTimeout, microtasks, fetch callbacks, requestAnimationFrameto stay under that span without you wrapping each boundary
929
+ - You start a span in one place (e.g., click handler) and want **all** follow-up work: nested setTimeout, microtasks, fetch callbacks, requestAnimationFrame: to stay under that span without you wrapping each boundary
930
930
  - You have deep or framework-driven async (e.g., React state updates → effects → fetch → more effects) and you can't or don't want to wrap every step
931
931
  - You rely on "current span" or "current trace ID" in code that runs in callbacks you don't control (e.g., third-party lib that calls your callback after a delay)
932
932
 
@@ -935,7 +935,7 @@ In those cases, Zone.js gives you one execution context that follows the entire
935
935
  ### Pitfalls of Zone.js
936
936
 
937
937
  **1. Bundle size and cost**
938
- Zone.js is on the order of ~1215 KB minified/gzipped. For a browser SDK that aims to be small (autotel-web lean is ~1.6 KB), adding Zone significantly increases size for every user.
938
+ Zone.js is on the order of ~12-15 KB minified/gzipped. For a browser SDK that aims to be small (autotel-web lean is ~1.6 KB), adding Zone significantly increases size for every user.
939
939
 
940
940
  **2. Global patching**
941
941
  Zone.js patches `setTimeout`, `setInterval`, `Promise`, `fetch`, `XHR`, `addEventListener`, and more. That can:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-web",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Ultra-lightweight browser SDK for distributed tracing - propagates W3C traceparent headers to backends using Autotel (~2-5KB gzipped)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "web-vitals": "^5.1.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/node": "^25.3.0",
59
+ "@types/node": "^25.3.3",
60
60
  "rimraf": "^6.1.3",
61
61
  "tsup": "^8.5.1",
62
62
  "typescript": "^5.9.3",