Skip to content

Release 2.4.0

Latest

Choose a tag to compare

@MichaelGHSeg MichaelGHSeg released this 29 Sep 16:28
· 1 commit to master since this release
36972cf

This release changes retry behaviour and adds two request headers. Please read the upgrade note before upgrading.

Upgrade note: new request headers

This release sends two request headers that earlier versions did not:
Authorization (HTTP Basic, carrying your write key) and X-Retry-Count
(sent on retries only). If traffic to Segment passes through a proxy, gateway
or WAF that allowlists request headers, add both before upgrading or uploads
will be rejected.

Retry handling

  • Uploads are retried on 408, 410, 429, 460, and 5xx except 501 and 505. 511 is retried only when an oauth_manager is configured, and dropped otherwise.
  • A Retry-After header is honoured on any retryable response, not only 429. Numeric seconds and the RFC 7231 HTTP-date formats are both accepted, and the value is capped at 300 seconds.
  • Responses carrying Retry-After are retried for up to max_rate_limit_duration and do not consume the retry count. A Retry-After that will not fit in what is left of the budget ends the episode rather than being shortened: retrying inside the window the server asked for sends a request it has already declined to serve, and the budget would be spent by then anyway. Other failures use exponential backoff from 500ms to a 60 second ceiling, limited by max_retries and by max_total_backoff_duration as an upper bound.
  • New client options, both in seconds: max_rate_limit_duration (default 1800) and max_total_backoff_duration (default 43200).
  • flush() and shutdown() are bounded by the same limits, and a pending retry does not delay shutdown.

Other changes

  • The write key is sent as an Authorization: Basic header. It remains in the request body, so no server-side change is required. Deployments using OAuth continue to send Authorization: Bearer.
  • X-Retry-Count is sent on retries, allowing the server to distinguish a retry from a first attempt. It is omitted on the first attempt.
  • Only 2xx responses count as a successful upload. A 3xx is reported as a failed upload rather than treated as delivered, and is not retried. The Segment endpoint does not redirect, so this affects only custom host values.

Full Changelog: 2.3.6...2.4.0