Skip to content

0.6.0

Latest

Choose a tag to compare

@bramhoven bramhoven released this 04 Sep 18:20
23d4239

Bodies are never truncated. A captured body is now recorded whole or not at all.

Truncating to max_body_bytes sliced JSON mid-token and stored a document that could not parse, with nothing in the payload to say so. A truncated capture was indistinguishable from an API that had genuinely returned malformed JSON, so a replayed sample raised JSONDecodeError and the blame landed upstream, on a failure that never happened. There is no byte count at which a JSON document is still a JSON document, so a larger default would only move the cliff.

New: max_payload_bytes, default 10 MiB. The size question is answered on the assembled payload rather than on individual bodies, because that is the quantity the server can measure too. Over the ceiling both bodies are omitted and bodies_omitted is set: the server records the request shape, its occurrence count and the response variant, stores no sample, and raises a dashboard alert. The endpoint stays visible and nothing half-captured is stored. The SDK logs a warning naming the endpoint and sizes, once per endpoint.

New: max_queue_bytes, default 32 MiB. queue_maxsize bounds items, not bytes, so with megabyte-scale payloads a full queue could hold gigabytes inside the application being instrumented.

Captures are compressed in transit. Payloads over 1 KiB are sent with Content-Encoding: gzip. Masked bodies are dominated by repeated <masked>, so they compress by roughly two orders of magnitude: a 111,110 byte capture goes out as 477 bytes. Set compress=False to disable. The size ceiling is applied before compression; limiting compressed bytes would let a payload under the limit expand to hundreds of megabytes on the server.

body_encoding is honoured on replay. The field records that a stored body is not the response itself, and the SDK sets it to base64 when it substitutes a 1x1 placeholder for an image. Replay ignored it, so an image recording was served as base64 text to code expecting image bytes. It is now decoded, and an unrecognised or malformed encoding falls back to the literal text rather than raising, so a stub's encoding cannot take a test suite down.

max_body_bytes is still accepted and no longer truncates anything.

If you run your own capture endpoint, note that captures now arrive gzipped unless you set compress=False; the hosted ingest handles this.

0.5.0 was never published, so its changelog entries are included here.

Published to PyPI as stubsmith 0.6.0.