Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement(datadog_logs sink): default to zstd compression #19456

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
5 changes: 5 additions & 0 deletions changelog.d/datadog-logs-zstd.enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Datadog Logs sink now defaults to zstd compression instead of gzip. This results in less
resource and higher throughput. You can explicitly set the compression to `gzip` to restore the
previous behavior.

authors: jszwedko
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ sinks:
inputs: [ "parse_message" ]
endpoint: "http://localhost:8080"
default_api_key: "DEADBEEF"
compression: "gzip"
healthcheck:
enabled: false
buffer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ sinks:
inputs: [ "parse_message" ]
endpoint: "http://localhost:8080"
default_api_key: "DEADBEEF"
compression: "gzip"
healthcheck:
enabled: false
buffer:
Expand Down
10 changes: 8 additions & 2 deletions src/sinks/datadog/logs/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ impl SinkBatchSettings for DatadogLogsDefaultBatchSettings {

/// Configuration for the `datadog_logs` sink.
#[configurable_component(sink("datadog_logs", "Publish log events to Datadog."))]
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Derivative)]
#[derivative(Default)]
#[serde(deny_unknown_fields)]
pub struct DatadogLogsConfig {
#[serde(flatten)]
pub local_dd_common: LocalDatadogCommonConfig,

#[configurable(derived)]
#[serde(default)]
#[derivative(Default(value = "default_compression()"))]
#[serde(default = "default_compression")]
pub compression: Option<Compression>,

#[configurable(derived)]
Expand All @@ -68,6 +70,10 @@ pub struct DatadogLogsConfig {
pub request: RequestConfig,
}

const fn default_compression() -> Option<Compression> {
Some(Compression::zstd_default())
}

impl GenerateConfig for DatadogLogsConfig {
fn generate_config() -> toml::Value {
toml::from_str(indoc! {r#"
Expand Down
39 changes: 21 additions & 18 deletions website/cue/reference/components/sinks/base/datadog_logs.cue
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,31 @@ base: components: sinks: datadog_logs: configuration: {
All compression algorithms use the default compression level unless otherwise specified.
"""
required: false
type: string: enum: {
gzip: """
[Gzip][gzip] compression.
type: string: {
default: "zstd"
enum: {
gzip: """
[Gzip][gzip] compression.

[gzip]: https://www.gzip.org/
"""
none: "No compression."
snappy: """
[Snappy][snappy] compression.
[gzip]: https://www.gzip.org/
"""
none: "No compression."
snappy: """
[Snappy][snappy] compression.

[snappy]: https://github.com/google/snappy/blob/main/docs/README.md
"""
zlib: """
[Zlib][zlib] compression.
[snappy]: https://github.com/google/snappy/blob/main/docs/README.md
"""
zlib: """
[Zlib][zlib] compression.

[zlib]: https://zlib.net/
"""
zstd: """
[Zstandard][zstd] compression.
[zlib]: https://zlib.net/
"""
zstd: """
[Zstandard][zstd] compression.

[zstd]: https://facebook.github.io/zstd/
"""
[zstd]: https://facebook.github.io/zstd/
"""
}
}
}
default_api_key: {
Expand Down
Loading