Logo
Explore Help
Register Sign In
rms/VictoriaMetrics
1
0
Fork 0
You've already forked VictoriaMetrics
mirror of https://github.com/VictoriaMetrics/VictoriaMetrics.git synced 2026-05-17 08:36:55 +03:00
Code Issues Packages Projects Releases Wiki Activity
Files
master
VictoriaMetrics/lib/encoding/util.go

13 lines
443 B
Go
Raw Permalink Normal View History

vmagent/remotewrite: set content encoding header based on actual body Improve remote write handling in vmagent by setting the `Content-Encoding` header based on the actual request body, rather than relying on configuration. - Detects Zstd compression via the Zstd magic number. - Falls back to Snappy if Zstd is not detected. - Persistent queue may now contain mixed-encoding content. - Add basic vmagent integration tests Follow up on https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5344 and https://github.com/VictoriaMetrics/VictoriaMetrics/commit/12cd32fd75706969f972a328e8583ca1da9e68c3. Extracted from https://github.com/VictoriaMetrics/VictoriaMetrics/pull/8462 Related issue: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5301
2025-04-08 17:12:06 +03:00
package encoding
import "encoding/binary"
// IsZstd checks if the given data is compressed using the zstd format.
// It does this by verifying the presence of the zstd magic number (0xFD2FB528)
// at the beginning of the byte slice.
//
// See: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#zstandard-frames
func IsZstd(data []byte) bool {
return len(data) >= 4 && binary.LittleEndian.Uint32(data) == 0xFD2FB528
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.5 Page: 273ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API