From ccbd49777deda1e39de73c1bd6ab33f3ae25aaec Mon Sep 17 00:00:00 2001 From: Zhenchi Date: Tue, 19 Dec 2023 14:14:40 +0800 Subject: [PATCH] fix: correct the error message for snappy compress (#2956) Signed-off-by: Zhenchi --- src/servers/src/error.rs | 8 ++++++++ src/servers/src/prom_store.rs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/servers/src/error.rs b/src/servers/src/error.rs index e105b6885ec6..665ecbaae1e3 100644 --- a/src/servers/src/error.rs +++ b/src/servers/src/error.rs @@ -214,6 +214,13 @@ pub enum Error { error: snap::Error, }, + #[snafu(display("Failed to compress prometheus remote request"))] + CompressPromRemoteRequest { + location: Location, + #[snafu(source)] + error: snap::Error, + }, + #[snafu(display("Invalid prometheus remote request, msg: {}", msg))] InvalidPromRemoteRequest { msg: String, location: Location }, @@ -444,6 +451,7 @@ impl ErrorExt for Error { | InvalidOpentsdbJsonRequest { .. } | DecodePromRemoteRequest { .. } | DecodeOtlpRequest { .. } + | CompressPromRemoteRequest { .. } | DecompressPromRemoteRequest { .. } | InvalidPromRemoteRequest { .. } | InvalidFlightTicket { .. } diff --git a/src/servers/src/prom_store.rs b/src/servers/src/prom_store.rs index a0a4725fa861..15183e217a42 100644 --- a/src/servers/src/prom_store.rs +++ b/src/servers/src/prom_store.rs @@ -370,7 +370,7 @@ pub fn snappy_compress(buf: &[u8]) -> Result> { let mut encoder = Encoder::new(); encoder .compress_vec(buf) - .context(error::DecompressPromRemoteRequestSnafu) + .context(error::CompressPromRemoteRequestSnafu) } /// Mock timeseries for test, it is both used in servers and frontend crate