perf(prom): release the compressed remote write body after decompression

Both the v1 and v2 decoders held the compressed Bytes until they returned,
which spans the whole protobuf decode and row conversion. Decompression
copies the payload into an independent buffer, so the body can go as soon
as it succeeds.

The compression fallback, decode errors and request counting are unchanged.

Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
This commit is contained in:
Dennis Zhuang
2026-09-19 22:22:05 +08:00
parent d9c94bdb0a
commit d7904f95da
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -77,6 +77,8 @@ pub fn decode_remote_write_request(
// fallback to the other compression method
try_decompress(!is_zstd, &body[..])?
};
// Decompression copied the payload out, so the compressed body is no longer needed.
drop(body);
let mut request = PROM_WRITE_REQUEST_POOL.pull(PromWriteRequest::default);
+2
View File
@@ -143,6 +143,8 @@ pub(crate) fn decode_remote_write_v2(
} else {
try_decompress(!is_zstd, &body[..])?
};
// Decompression copied the payload out, so the compressed body is no longer needed.
drop(body);
let request = BorrowedRequest::decode(&buf).context(error::DecodePromRemoteRequestSnafu)?;
drop(decode_timer);