Skip to content

CONCEPT Cited by 1 source

sendBeacon telemetry transport

Definition

sendBeacon() (navigator.sendBeacon) is a browser API designed for sending small amounts of data to a server asynchronously and reliably, at a low priority, without blocking the page. It was added to the web platform specifically for telemetry and analytics use cases.

Key properties:

  • Low-priority network queue — doesn't compete with user-initiated requests (fetch, XHR) for bandwidth.
  • Page-unload safe — continues to transmit even if the user navigates away or closes the tab, which is the main reason telemetry libraries prefer it over fetch.
  • Fire-and-forget — no response callback; suited to data that doesn't need acknowledgement.
  • Size-limited — typically 64 KB per beacon (browser- specific).

Why observability SDKs use it

Telemetry data is by definition not on the user's critical path — the user doesn't care whether their page load trace arrived at the collector. Making the browser treat telemetry network calls as low-priority means:

  • Faster page loads (no contention for network slots).
  • Reliable delivery at page close (normal fetch would be cancelled).
  • No blocking of synchronous unload handlers.

Zalando's use

The browser SDK exports its spans and metrics via sendBeacon() "to push the network requests to be least critical" (Source: sources/2024-07-28-zalando-opentelemetry-for-javascript-observability-at-zalando). This pairs with concepts/cherry-picked-instrumentation-payload and the edge-proxy ingress pattern to keep telemetry off the critical path on both compute (small bundle, async-loaded) and network (low-priority transport).

Limitations

  • Body size cap makes it unsuitable for large payloads; for per-page-load metrics this is fine, but large OTel span batches may need chunking.
  • Not all browsers fully implement the feature (check compatibility), though coverage is broad now.
  • No response callback — errors / retries must be handled differently.

Seen in

Last updated · 501 distilled / 1,218 read