Skip to content

Commit 5204a74

Browse files
committed
feat: Implement zstd compression
1 parent 083feb4 commit 5204a74

File tree

1 file changed

+7
-1
lines changed
  • opentelemetry-otlp/src/exporter/http

1 file changed

+7
-1
lines changed

opentelemetry-otlp/src/exporter/http/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,14 @@ impl OtlpHttpClient {
301301
Some(crate::Compression::Gzip) => {
302302
Err("gzip compression requested but gzip-http feature not enabled".to_string())
303303
}
304+
#[cfg(feature = "zstd-http")]
304305
Some(crate::Compression::Zstd) => {
305-
Err("zstd compression not implemented yet".to_string())
306+
let compressed = zstd::bulk::compress(&body, 0).map_err(|e| e.to_string())?;
307+
Ok((compressed, Some("zstd")))
308+
}
309+
#[cfg(not(feature = "zstd-http"))]
310+
Some(crate::Compression::Zstd) => {
311+
Err("zstd compression requested but zstd-http feature not enabled".to_string())
306312
}
307313
None => Ok((body, None)),
308314
}

0 commit comments

Comments
 (0)