Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
317 changes: 284 additions & 33 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ camino,https://github.com/camino-rs/camino,MIT OR Apache-2.0,"Without Boats <sao
cargo-platform,https://github.com/rust-lang/cargo,MIT OR Apache-2.0,The cargo-platform Authors
cargo_metadata,https://github.com/oli-obk/cargo_metadata,MIT,Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
cc,https://github.com/rust-lang/cc-rs,MIT OR Apache-2.0,Alex Crichton <alex@alexcrichton.com>
cesu8,https://github.com/emk/cesu8-rs,Apache-2.0 OR MIT,Eric Kidd <git@randomhacks.net>
cexpr,https://github.com/jethrogb/rust-cexpr,Apache-2.0 OR MIT,Jethro Beekman <jethro@jbeekman.nl>
cfg-if,https://github.com/rust-lang/cfg-if,MIT OR Apache-2.0,Alex Crichton <alex@alexcrichton.com>
clang-sys,https://github.com/KyleMayes/clang-sys,Apache-2.0,Kyle Mayes <kyle@mayeses.com>
combine,https://github.com/Marwes/combine,MIT,Markus Westerlind <marwes91@gmail.com>
concurrent-queue,https://github.com/smol-rs/concurrent-queue,Apache-2.0 OR MIT,"Stjepan Glavina <stjepang@gmail.com>, Taiki Endo <te316e89@gmail.com>, John Nunley <dev@notgull.net>"
const_format,https://github.com/rodrimati1992/const_format_crates,Zlib,rodrimati1992 <rodrimatt1985@gmail.com>
const_format_proc_macros,https://github.com/rodrimati1992/const_format_crates,Zlib,rodrimati1992 <rodrimatt1985@gmail.com>
Expand Down Expand Up @@ -112,6 +114,10 @@ ipnet,https://github.com/krisprice/ipnet,MIT OR Apache-2.0,Kris Price <kris@kris
iri-string,https://github.com/lo48576/iri-string,MIT OR Apache-2.0,YOSHIOKA Takuma <nop_thread@nops.red>
itertools,https://github.com/rust-itertools/itertools,MIT OR Apache-2.0,bluss
itoa,https://github.com/dtolnay/itoa,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
jni,https://github.com/jni-rs/jni-rs,MIT OR Apache-2.0,Josh Chase <josh@prevoty.com>
jni-sys,https://github.com/jni-rs/jni-sys,MIT OR Apache-2.0,Steven Fackler <sfackler@gmail.com>
jni-sys,https://github.com/jni-rs/jni-sys,MIT OR Apache-2.0,"Steven Fackler <sfackler@gmail.com>, Robert Bragg <robert@sixbynine.org>"
Comment thread
duncanpharvey marked this conversation as resolved.
jni-sys-macros,https://github.com/jni-rs/jni-sys,MIT OR Apache-2.0,Robert Bragg <robert@sixbynine.org>
jobserver,https://github.com/rust-lang/jobserver-rs,MIT OR Apache-2.0,Alex Crichton <alex@alexcrichton.com>
js-sys,https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/js-sys,MIT OR Apache-2.0,The wasm-bindgen Developers
lazy_static,https://github.com/rust-lang-nursery/lazy-static.rs,MIT OR Apache-2.0,Marvin Löbel <loebel.marvin@gmail.com>
Expand Down Expand Up @@ -209,17 +215,21 @@ rustix,https://github.com/bytecodealliance/rustix,Apache-2.0 WITH LLVM-exception
rustls,https://github.com/rustls/rustls,Apache-2.0 OR ISC OR MIT,The rustls Authors
rustls-native-certs,https://github.com/rustls/rustls-native-certs,Apache-2.0 OR ISC OR MIT,The rustls-native-certs Authors
rustls-pki-types,https://github.com/rustls/pki-types,MIT OR Apache-2.0,The rustls-pki-types Authors
rustls-platform-verifier,https://github.com/rustls/rustls-platform-verifier,MIT OR Apache-2.0,The rustls-platform-verifier Authors
rustls-platform-verifier-android,https://github.com/rustls/rustls-platform-verifier,MIT OR Apache-2.0,The rustls-platform-verifier-android Authors
rustls-webpki,https://github.com/rustls/webpki,ISC,The rustls-webpki Authors
rustversion,https://github.com/dtolnay/rustversion,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
rusty-fork,https://github.com/altsysrq/rusty-fork,MIT OR Apache-2.0,Jason Lingle
ryu,https://github.com/dtolnay/ryu,Apache-2.0 OR BSL-1.0,David Tolnay <dtolnay@gmail.com>
same-file,https://github.com/BurntSushi/same-file,Unlicense OR MIT,Andrew Gallant <jamslam@gmail.com>
schannel,https://github.com/steffengy/schannel-rs,MIT,"Steven Fackler <sfackler@gmail.com>, Steffen Butzer <steffen.butzer@outlook.com>"
scopeguard,https://github.com/bluss/scopeguard,MIT OR Apache-2.0,bluss
security-framework,https://github.com/kornelski/rust-security-framework,MIT OR Apache-2.0,"Steven Fackler <sfackler@gmail.com>, Kornel <kornel@geekhood.net>"
security-framework-sys,https://github.com/kornelski/rust-security-framework,MIT OR Apache-2.0,"Steven Fackler <sfackler@gmail.com>, Kornel <kornel@geekhood.net>"
semver,https://github.com/dtolnay/semver,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
serde,https://github.com/serde-rs/serde,MIT OR Apache-2.0,"Erick Tryzelaar <erick.tryzelaar@gmail.com>, David Tolnay <dtolnay@gmail.com>"
serde-aux,https://github.com/iddm/serde-aux,MIT,Victor Polevoy <maintainer@vpolevoy.com>
serde-transcode,https://github.com/sfackler/serde-transcode,MIT OR Apache-2.0,Steven Fackler <sfackler@palantir.com>
serde-value,https://github.com/arcnmx/serde-value,MIT,arcnmx
serde_bytes,https://github.com/serde-rs/bytes,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
serde_core,https://github.com/serde-rs/serde,MIT OR Apache-2.0,"Erick Tryzelaar <erick.tryzelaar@gmail.com>, David Tolnay <dtolnay@gmail.com>"
Expand Down Expand Up @@ -249,6 +259,7 @@ synstructure,https://github.com/mystor/synstructure,MIT,Nika Layzell <nika@thela
sys-info,https://github.com/FillZpp/sys-info-rs,MIT,Siyu Wang <FillZpp.pub@gmail.com>
tabwriter,https://github.com/BurntSushi/tabwriter,Unlicense OR MIT,Andrew Gallant <jamslam@gmail.com>
tempfile,https://github.com/Stebalien/tempfile,MIT OR Apache-2.0,"Steven Allen <steven@stebalien.com>, The Rust Project Developers, Ashley Mannix <ashleymannix@live.com.au>, Jason White <me@jasonwhite.io>"
thin-vec,https://github.com/mozilla/thin-vec,MIT OR Apache-2.0,Aria Beingessner <a.beingessner@gmail.com>
thiserror,https://github.com/dtolnay/thiserror,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
thiserror-impl,https://github.com/dtolnay/thiserror,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
thread_local,https://github.com/Amanieu/thread_local-rs,MIT OR Apache-2.0,Amanieu d'Antras <amanieu@gmail.com>
Expand Down Expand Up @@ -301,8 +312,10 @@ wasm-metadata,https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wa
wasmparser,https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wasmparser,Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT,Yury Delendik <ydelendik@mozilla.com>
web-sys,https://github.com/wasm-bindgen/wasm-bindgen/tree/master/crates/web-sys,MIT OR Apache-2.0,The wasm-bindgen Developers
web-time,https://github.com/daxpedda/web-time,MIT OR Apache-2.0,The web-time Authors
webpki-root-certs,https://github.com/rustls/webpki-roots,CDLA-Permissive-2.0,The webpki-root-certs Authors
webpki-roots,https://github.com/rustls/webpki-roots,CDLA-Permissive-2.0,The webpki-roots Authors
which,https://github.com/harryfei/which-rs,MIT,Harry Fei <tiziyuanfang@gmail.com>
winapi-util,https://github.com/BurntSushi/winapi-util,Unlicense OR MIT,Andrew Gallant <jamslam@gmail.com>
windows,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
windows-link,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,The windows-link Authors
windows-sys,https://github.com/microsoft/windows-rs,MIT OR Apache-2.0,Microsoft
Expand Down
4 changes: 2 additions & 2 deletions crates/datadog-agent-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ license.workspace = true

[dependencies]
figment = { version = "0.10", default-features = false, features = ["yaml", "env"] }
libdd-trace-obfuscation = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c", default-features = false }
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c", default-features = false }
libdd-trace-obfuscation = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe", default-features = false }
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe", default-features = false }
log = { version = "0.4", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde-aux = { version = "4.7", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/datadog-metrics-collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Collector to read, compute, and submit enhanced metrics in Server
[dependencies]
dogstatsd = { path = "../dogstatsd", default-features = true }
tracing = { version = "0.1", default-features = false }
libdd-common = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c", default-features = false }
libdd-common = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe", default-features = false }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = ["Win32_System_JobObjects"], optional = true, default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/datadog-serverless-compat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ windows-enhanced-metrics = ["datadog-metrics-collector/windows-enhanced-metrics"
datadog-logs-agent = { path = "../datadog-logs-agent" }
datadog-metrics-collector = { path = "../datadog-metrics-collector" }
datadog-trace-agent = { path = "../datadog-trace-agent" }
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
datadog-fips = { path = "../datadog-fips", default-features = false }
dogstatsd = { path = "../dogstatsd", default-features = true }
reqwest = { version = "0.12.4", default-features = false }
Expand Down
18 changes: 9 additions & 9 deletions crates/datadog-trace-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ tracing = { version = "0.1", default-features = false }
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0"
thiserror = { version = "1.0.58", default-features = false }
libdd-capabilities = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-capabilities-impl = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-common = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-library-config = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-trace-protobuf = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-trace-stats = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c", features = [
libdd-capabilities = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
libdd-capabilities-impl = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
libdd-common = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
libdd-library-config = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
libdd-trace-protobuf = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
libdd-trace-stats = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe", features = [
"mini_agent",
] }
libdd-trace-obfuscation = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c" }
libdd-trace-obfuscation = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe" }
datadog-fips = { path = "../datadog-fips" }
reqwest = { version = "0.12.23", features = [
"json",
Expand All @@ -49,6 +49,6 @@ serial_test = "2.0.0"
duplicate = "2.0.1"
temp-env = "0.3.6"
tempfile = "3.3.0"
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "a820699426f28cbabb3a74d87c7309d030b52e7c", features = [
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "def0a56d1686661e812c6fedb5902ad1cd28d8fe", features = [
"test-utils",
] }
86 changes: 86 additions & 0 deletions crates/datadog-trace-agent/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ pub struct Config {
pub proxy_url: Option<String>,
pub env: String,
pub peer_tags: Vec<String>,
/// Gates additional_metric_tags and related config.
pub experimental_features_enabled: bool,
/// Tag keys extracted from spans and used as additional aggregation dimensions in stats.
/// Only populated when experimental_features_enabled is true.
pub additional_metric_tags: Vec<String>,
/// Configures the per-bucket cardinality limit for additional_metric_tags stat entries.
/// Only populated when experimental_features_enabled is true.
pub additional_metric_tags_cardinality_limit: Option<usize>,
/// Whether the agent should compute trace stats
pub agent_stats_computation_enabled: bool,
}
Expand Down Expand Up @@ -216,6 +224,10 @@ impl Config {
Tags::new()
};

let experimental_features_enabled = env::var("DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED")
.map(|val| val.to_lowercase() == "true")
.unwrap_or(false);

#[allow(clippy::unwrap_used)]
Ok(Config {
app_name: Some(app_name),
Expand Down Expand Up @@ -262,6 +274,30 @@ impl Config {
tags,
env: env::var("DD_ENV").unwrap_or_else(|_| "none".to_string()),
peer_tags: peer_tag_keys()?,
experimental_features_enabled,
additional_metric_tags: if experimental_features_enabled {
env::var("DD_TRACE_STATS_ADDITIONAL_TAGS")
.ok()
.filter(|s| !s.is_empty())
.map(|s| {
s.split(',')
.map(str::trim)
.filter(|s| !s.is_empty())
.map(str::to_owned)
.collect()
})
.unwrap_or_default()
} else {
vec![]
},
additional_metric_tags_cardinality_limit: if experimental_features_enabled {
env::var("DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT")
.ok()
.and_then(|s| s.trim().parse::<usize>().ok())
.filter(|&n| n > 0)
} else {
None
},
agent_stats_computation_enabled: env::var("DD_AGENT_STATS_COMPUTATION_ENABLED")
.map(|val| val.to_lowercase() == "true")
.unwrap_or(false),
Expand Down Expand Up @@ -745,6 +781,53 @@ mod tests {
},
);
}

#[test]
#[serial]
fn test_additional_metric_tags_gated_by_experimental_flag() {
let base_vars = [
("DD_API_KEY", Some("_not_a_real_key_")),
("FUNCTIONS_EXTENSION_VERSION", Some("~4")),
("FUNCTIONS_WORKER_RUNTIME", Some("dotnet")),
("WEBSITE_SITE_NAME", Some("my-azure-function")),
("DD_TRACE_STATS_ADDITIONAL_TAGS", Some("region,tenant_id")),
(
"DD_TRACE_STATS_ADDITIONAL_TAGS_CARDINALITY_LIMIT",
Some("50"),
),
];

temp_env::with_vars(
base_vars
.iter()
.cloned()
.chain([("DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED", Some("false"))])
.collect::<Vec<_>>(),
|| {
let config = config::Config::new().unwrap();
assert!(!config.experimental_features_enabled);
assert!(config.additional_metric_tags.is_empty());
assert_eq!(config.additional_metric_tags_cardinality_limit, None);
},
);

temp_env::with_vars(
base_vars
.iter()
.cloned()
.chain([("DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED", Some("true"))])
.collect::<Vec<_>>(),
|| {
let config = config::Config::new().unwrap();
assert!(config.experimental_features_enabled);
assert_eq!(
config.additional_metric_tags,
vec!["region".to_string(), "tenant_id".to_string()]
);
assert_eq!(config.additional_metric_tags_cardinality_limit, Some(50));
},
);
}
}

/// Test helpers for creating Config instances in tests
Expand Down Expand Up @@ -782,6 +865,9 @@ pub mod test_helpers {
proxy_url: None,
env: "none".to_string(),
peer_tags: peer_tag_keys().unwrap(),
experimental_features_enabled: false,
additional_metric_tags: vec![],
additional_metric_tags_cardinality_limit: None,
agent_stats_computation_enabled: false,
}
}
Expand Down
Loading
Loading