Skip to content

Commit

Permalink
enhancement(datadog_agent source): enable zstd decompression (#20732)
Browse files Browse the repository at this point in the history
* Handle zstd

Signed-off-by: Stephen Wakely <[email protected]>

* Update integration tests to send zstd.

Signed-off-by: Stephen Wakely <[email protected]>

* Changelog

Signed-off-by: Stephen Wakely <[email protected]>

* Feedback from Jesse

Signed-off-by: Stephen Wakely <[email protected]>

---------

Signed-off-by: Stephen Wakely <[email protected]>
  • Loading branch information
StephenWakely authored Jul 2, 2024
1 parent d778c6f commit def8b7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/20732_datadog_agent_zstd.enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow the `datadog_agent` source to accept payloads that have been compressed with `zstd`.
1 change: 1 addition & 0 deletions scripts/integration/datadog-agent/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- DD_CMD_PORT=5001
- DD_USE_DOGSTATSD=false
- DD_HOSTNAME=datadog-agent
- DD_SERIALIZER_COMPRESSOR_KIND=zstd
volumes:
- ../../../tests/data/datadog-agent/conf.yaml:/etc/datadog-agent/conf.d/test.d/conf.yaml
datadog-trace-agent:
Expand Down
6 changes: 6 additions & 0 deletions src/sources/datadog_agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ impl DatadogAgentSource {
.map_err(|error| handle_decode_error(encoding, error))?;
decoded.into()
}
"zstd" => {
let mut decoded = Vec::new();
zstd::stream::copy_decode(body.reader(), &mut decoded)
.map_err(|error| handle_decode_error(encoding, error))?;
decoded.into()
}
"deflate" | "x-deflate" => {
let mut decoded = Vec::new();
ZlibDecoder::new(body.reader())
Expand Down

0 comments on commit def8b7f

Please sign in to comment.