feat(sentry): decode zstd request bodies - #350
Draft
tsan88 wants to merge 1 commit into
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sentry-php4.x sends envelopes withContent-Encoding: zstdby default, butdecompress()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 parsewarning 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
zstdhandled both by the declaredContent-Encodingand by magic bytes (28 b5 2f fd), matching how gzip and zlib are already auto-detected.github.com/klauspost/compresspromoted from an indirect to a direct dependency. It is already ingo.sum(pulled in byprometheus/common), so no new module enters the build.Testing
go vet ./...,go test ./...andgo buildpass. AddedTestDecompresssubtests for the declared encoding and for auto-detection. Running in production on our instance since 2026-09-03.