Skip to content

feat(sentry): decode zstd request bodies - #350

Draft
tsan88 wants to merge 1 commit into
buggregator:masterfrom
tsan88:feat/sentry-zstd-encoding
Draft

feat(sentry): decode zstd request bodies#350
tsan88 wants to merge 1 commit into
buggregator:masterfrom
tsan88:feat/sentry-zstd-encoding

Conversation

@tsan88

@tsan88 tsan88 commented Sep 4, 2026

Copy link
Copy Markdown

sentry-php 4.x sends envelopes with Content-Encoding: zstd by default, but decompress() only knew gzip and deflate. The body stayed compressed, failed to parse as an envelope, and the event was dropped.

This loss is invisible in the logs: there is no failed to parse warning for it, and the SDK gets HTTP 200. We only found it by comparing the proxy access log with row counts in the database.

Changes

  • zstd handled both by the declared Content-Encoding and by magic bytes (28 b5 2f fd), matching how gzip and zlib are already auto-detected.
  • github.com/klauspost/compress promoted from an indirect to a direct dependency. It is already in go.sum (pulled in by prometheus/common), so no new module enters the build.

Testing

go vet ./..., go test ./... and go build pass. Added TestDecompress subtests for the declared encoding and for auto-detection. Running in production on our instance since 2026-09-03.

sentry-php 4.x sends envelopes with Content-Encoding: zstd by default, but
decompress() only knew gzip and deflate. The body stayed compressed, failed to
parse as an envelope and the event was dropped — without a "failed to parse"
warning, so the loss was invisible in the logs while the SDK saw HTTP 200.

Handles both the declared encoding and the zstd magic bytes, matching how gzip
and zlib are already auto-detected.

github.com/klauspost/compress is promoted from an indirect to a direct
dependency; it is already present in go.sum (pulled in by prometheus/common),
so no new module enters the build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant