Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ examples/cxx/exporter_manager.exe
examples/cxx/profiling
examples/cxx/profiling.exe
profile.pprof
*.snap.new
82 changes: 82 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ colorchoice,https://github.com/rust-cli/anstyle,MIT OR Apache-2.0,The colorchoic
colored,https://github.com/mackwic/colored,MPL-2.0,Thomas Wickham <mackwic@gmail.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>"
console,https://github.com/console-rs/console,MIT,The console Authors
console-api,https://github.com/tokio-rs/console,MIT,"Eliza Weisman <eliza@buoyant.io>, Tokio Contributors <team@tokio.rs>"
console-subscriber,https://github.com/tokio-rs/console,MIT,"Eliza Weisman <eliza@buoyant.io>, Tokio Contributors <team@tokio.rs>"
const_format,https://github.com/rodrimati1992/const_format_crates,Zlib,rodrimati1992 <rodrimatt1985@gmail.com>
Expand Down Expand Up @@ -125,6 +126,7 @@ dispatch2,https://github.com/madsmtm/objc2,Zlib OR Apache-2.0 OR MIT,"Mads Marqu
displaydoc,https://github.com/yaahc/displaydoc,MIT OR Apache-2.0,Jane Lusby <jlusby@yaah.dev>
dyn-clone,https://github.com/dtolnay/dyn-clone,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
either,https://github.com/rayon-rs/either,MIT OR Apache-2.0,bluss
encode_unicode,https://github.com/tormol/encode_unicode,Apache-2.0 OR MIT,Torbjørn Birch Moltu <t.b.moltu@lyse.net>
encoding_rs,https://github.com/hsivonen/encoding_rs,(Apache-2.0 OR MIT) AND BSD-3-Clause,Henri Sivonen <hsivonen@hsivonen.fi>
enum-as-inner,https://github.com/bluejekyll/enum-as-inner,MIT OR Apache-2.0,Benjamin Fry <benjaminfry@me.com>
equivalent,https://github.com/cuviper/equivalent,Apache-2.0 OR MIT,The equivalent Authors
Expand Down Expand Up @@ -282,6 +284,10 @@ parking_lot_core,https://github.com/Amanieu/parking_lot,MIT OR Apache-2.0,Amanie
paste,https://github.com/dtolnay/paste,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
path-tree,https://github.com/viz-rs/path-tree,MIT OR Apache-2.0,Fangdun Tsai <cfddream@gmail.com>
percent-encoding,https://github.com/servo/rust-url,MIT OR Apache-2.0,The rust-url developers
pest,https://github.com/pest-parser/pest,MIT OR Apache-2.0,Dragoș Tiselice <dragostiselice@gmail.com>
pest_derive,https://github.com/pest-parser/pest,MIT OR Apache-2.0,Dragoș Tiselice <dragostiselice@gmail.com>
pest_generator,https://github.com/pest-parser/pest,MIT OR Apache-2.0,Dragoș Tiselice <dragostiselice@gmail.com>
pest_meta,https://github.com/pest-parser/pest,MIT OR Apache-2.0,Dragoș Tiselice <dragostiselice@gmail.com>
petgraph,https://github.com/petgraph/petgraph,MIT OR Apache-2.0,"bluss, mitchmindtree"
pico-args,https://github.com/RazrFalcon/pico-args,MIT,Yevhenii Reizner <razrfalcon@gmail.com>
pin-project,https://github.com/taiki-e/pin-project,Apache-2.0 OR MIT,The pin-project Authors
Expand Down Expand Up @@ -464,6 +470,7 @@ try-lock,https://github.com/seanmonstar/try-lock,MIT,Sean McArthur <sean@seanmon
twox-hash,https://github.com/shepmaster/twox-hash,MIT,Jake Goulding <jake.goulding@gmail.com>
typeid,https://github.com/dtolnay/typeid,MIT OR Apache-2.0,David Tolnay <dtolnay@gmail.com>
typenum,https://github.com/paholg/typenum,MIT OR Apache-2.0,"Paho Lurie-Gregg <paho@paholg.com>, Andre Bogus <bogusandre@gmail.com>"
ucd-trie,https://github.com/BurntSushi/ucd-generate,MIT OR Apache-2.0,Andrew Gallant <jamslam@gmail.com>
unarray,https://github.com/cameron1024/unarray,MIT OR Apache-2.0,The unarray Authors
unicase,https://github.com/seanmonstar/unicase,MIT OR Apache-2.0,Sean McArthur <sean@seanmonstar.com>
unicode-ident,https://github.com/dtolnay/unicode-ident,(MIT OR Apache-2.0) AND Unicode-DFS-2016,David Tolnay <dtolnay@gmail.com>
Expand Down
4 changes: 2 additions & 2 deletions libdd-common/src/regex_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! regexes requiring Unicode character class support.

#[cfg(all(feature = "regex-lite", not(feature = "require-regex-full")))]
pub use regex_lite::{escape, Captures, Regex, RegexBuilder, Replacer};
pub use regex_lite::{escape, Captures, Error, Regex, RegexBuilder, Replacer};

#[cfg(not(all(feature = "regex-lite", not(feature = "require-regex-full"))))]
pub use regex::{escape, Captures, Regex, RegexBuilder, Replacer};
pub use regex::{escape, Captures, Error, Regex, RegexBuilder, Replacer};
1 change: 1 addition & 0 deletions libdd-data-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ tokio = { version = "1.23", features = [
"time",
"test-util",
], default-features = false }
insta = { version = "1.47.2", features = ["json", "redactions"] }

[features]
default = ["https", "telemetry"]
Expand Down
15 changes: 10 additions & 5 deletions libdd-data-pipeline/src/agent_info/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,25 @@ pub struct AgentInfoStruct {
/// Container tags hash from HTTP response header
pub container_tags_hash: Option<String>,
/// Exact-match tag filters applied before stats computation (root span only).
pub filter_tags: Option<FilterTagsConfig>,
#[serde(default)]
pub filter_tags: FilterTagsConfig,
/// Regex-match tag filters applied before stats computation (root span only).
pub filter_tags_regex: Option<FilterTagsConfig>,
#[serde(default)]
pub filter_tags_regex: FilterTagsConfig,
/// Regex patterns for root-span resource names; matching traces are excluded from stats.
pub ignore_resources: Option<Vec<String>>,
#[serde(default)]
pub ignore_resources: Vec<String>,
}

/// Require/reject lists for tag-based trace filters exposed by the agent /info endpoint.
#[derive(Clone, Serialize, Deserialize, Default, Debug, PartialEq)]
pub struct FilterTagsConfig {
/// All listed filters must match at least one root-span tag for the trace to be accepted.
pub require: Option<Vec<String>>,
#[serde(default)]
pub require: Vec<String>,
/// If any listed filter matches a root-span tag the trace is rejected.
pub reject: Option<Vec<String>>,
#[serde(default)]
pub reject: Vec<String>,
}

#[allow(missing_docs)]
Expand Down
28 changes: 28 additions & 0 deletions libdd-data-pipeline/src/trace_exporter/builder.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use crate::agent_info::schema::FilterTagsConfig;
use crate::agent_info::AgentInfoFetcher;
use crate::otlp::config::{OtlpProtocol, DEFAULT_OTLP_TIMEOUT};
use crate::otlp::OtlpTraceConfig;
#[cfg(all(not(target_arch = "wasm32"), feature = "telemetry"))]
use crate::telemetry::TelemetryClientBuilder;
use crate::trace_exporter::agent_response::AgentResponsePayloadVersion;
use crate::trace_exporter::error::BuilderErrorKind;
use crate::trace_exporter::trace_filter::TraceFilterer;
#[cfg(all(not(target_arch = "wasm32"), feature = "telemetry"))]
use crate::trace_exporter::TelemetryConfig;
#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -65,6 +67,9 @@ pub struct TraceExporterBuilder {
connection_timeout: Option<u64>,
otlp_endpoint: Option<String>,
otlp_headers: Vec<(String, String)>,
filter_tags: FilterTagsConfig,
filter_tags_regex: FilterTagsConfig,
ignore_resources: Vec<String>,
}

impl TraceExporterBuilder {
Expand Down Expand Up @@ -286,6 +291,24 @@ impl TraceExporterBuilder {
self
}

// TODO: doc
pub fn set_filter_tags(&mut self, filter_tags: FilterTagsConfig) -> &mut Self {
self.filter_tags = filter_tags;
self
}

// TODO: doc
pub fn set_filter_tags_regex(&mut self, filter_tags_regex: FilterTagsConfig) -> &mut Self {
self.filter_tags_regex = filter_tags_regex;
self
}

// TODO: doc
pub fn set_ignore_resources(&mut self, ignore_resources: Vec<String>) -> &mut Self {
self.ignore_resources = ignore_resources;
self
}

#[allow(missing_docs)]
pub fn build<C: HttpClientCapability + SleepCapability + MaybeSend + Sync + 'static>(
self,
Expand Down Expand Up @@ -496,6 +519,11 @@ impl TraceExporterBuilder {
.agent_rates_payload_version_enabled
.then(AgentResponsePayloadVersion::new),
otlp_config,
trace_filterer: TraceFilterer::new(
&self.filter_tags,
&self.filter_tags_regex,
&self.ignore_resources,
),
})
}

Expand Down
Loading
Loading