Skip to content

Commit ca31d5f

Browse files
authored
chore(components): remove usages of facet (#2321)
## Summary As stated in the PR title. Our original intent for using `facet` was to get around the limitations of `serde` in the context of using it to deal with Agent configuration. Now that we have the full configuration schema for the Agent, however, we can do much more up front at build time, almost entirely obviating the need for a hypothetical and bespoke configuration loading system based on `facet`. As such, we're removing the code. :) ## Change Type - [ ] Bug fix - [ ] New feature - [x] Non-functional (chore, refactoring, docs) - [ ] Performance ## How did you test this PR? Existing tests, lints, etc etc. ## References DADP-2 Co-authored-by: toby.lawrence <toby.lawrence@datadoghq.com>
1 parent f76d1fb commit ca31d5f

15 files changed

Lines changed: 33 additions & 169 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ async-compression = { version = "0.4.42", default-features = false, features = [
111111
] }
112112
zstd = { version = "0.13.3", default-features = false }
113113
bitmask-enum = { version = "2.2", default-features = false }
114-
facet = { version = "0.46.0", default-features = false, features = ["std"] }
115114
figment = { version = "0.10", default-features = false }
116115
foldhash = { version = "0.2", default-features = false, features = ["std"] }
117116
headers = { version = "0.4", default-features = false }

LICENSE-3rdparty.csv

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ combine,https://github.com/Marwes/combine,MIT,Markus Westerlind <marwes91@gmail.
7373
comfy-table,https://github.com/nukesor/comfy-table,MIT,Arne Beer <contact@arne.beer>
7474
compression-codecs,https://github.com/Nullus157/async-compression,MIT OR Apache-2.0,"Wim Looman <wim@nemo157.com>, Allen Bui <fairingrey@gmail.com>"
7575
compression-core,https://github.com/Nullus157/async-compression,MIT OR Apache-2.0,"Wim Looman <wim@nemo157.com>, Allen Bui <fairingrey@gmail.com>"
76-
const-fnv1a-hash,https://github.com/HindrikStegenga/const-fnv1a-hash,MIT,The const-fnv1a-hash Authors
7776
const-hex,https://github.com/danipopes/const-hex,MIT OR Apache-2.0,DaniPopes <57450786+DaniPopes@users.noreply.github.com>
7877
const-oid,https://github.com/RustCrypto/formats,Apache-2.0 OR MIT,RustCrypto Developers
7978
const-oid,https://github.com/RustCrypto/formats/tree/master/const-oid,Apache-2.0 OR MIT,RustCrypto Developers
@@ -112,12 +111,6 @@ encoding_rs_io,https://github.com/BurntSushi/encoding_rs_io,MIT OR Apache-2.0,An
112111
enum_dispatch,https://gitlab.com/antonok/enum_dispatch,MIT OR Apache-2.0,Anton Lazarev <https://antonok.com>
113112
equivalent,https://github.com/indexmap-rs/equivalent,Apache-2.0 OR MIT,The equivalent Authors
114113
errno,https://github.com/lambda-fairy/rust-errno,MIT OR Apache-2.0,"Chris Wong <lambda.fairy@gmail.com>, Dan Gohman <dev@sunfishcode.online>"
115-
facet,https://github.com/facet-rs/facet,MIT OR Apache-2.0,The facet Authors
116-
facet-core,https://github.com/facet-rs/facet,MIT OR Apache-2.0,The facet-core Authors
117-
facet-macro-parse,https://github.com/facet-rs/facet,MIT OR Apache-2.0,The facet-macro-parse Authors
118-
facet-macro-types,https://github.com/facet-rs/facet,MIT OR Apache-2.0,The facet-macro-types Authors
119-
facet-macros,https://github.com/facet-rs/facet,MIT OR Apache-2.0,The facet-macros Authors
120-
facet-macros-impl,https://github.com/facet-rs/facet,MIT OR Apache-2.0,The facet-macros-impl Authors
121114
faster-hex,https://github.com/NervosFoundation/faster-hex,MIT,zhangsoledad <787953403@qq.com>
122115
fastrand,https://github.com/smol-rs/fastrand,Apache-2.0 OR MIT,Stjepan Glavina <stjepang@gmail.com>
123116
figment,https://github.com/SergioBenitez/Figment,MIT OR Apache-2.0,Sergio Benitez <sb@sergio.bz>
@@ -179,11 +172,9 @@ icu_properties,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Projec
179172
icu_properties_data,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers
180173
icu_provider,https://github.com/unicode-org/icu4x,Unicode-3.0,The ICU4X Project Developers
181174
id-arena,https://github.com/fitzgen/id-arena,MIT OR Apache-2.0,"Nick Fitzgerald <fitzgen@gmail.com>, Aleksey Kladov <aleksey.kladov@gmail.com>"
182-
iddqd,https://github.com/oxidecomputer/iddqd,MIT OR Apache-2.0,The iddqd Authors
183175
ident_case,https://github.com/TedDriggs/ident_case,MIT OR Apache-2.0,Ted Driggs <ted.driggs@outlook.com>
184176
idna,https://github.com/servo/rust-url,MIT OR Apache-2.0,The rust-url developers
185177
idna_adapter,https://github.com/hsivonen/idna_adapter,Apache-2.0 OR MIT,The rust-url developers
186-
impls,https://github.com/nvzqz/impls,MIT OR Apache-2.0,"Nikolai Vazquez, Nadrieril Feneanar"
187178
indexmap,https://github.com/indexmap-rs/indexmap,Apache-2.0 OR MIT,The indexmap Authors
188179
inlinable_string,https://github.com/fitzgen/inlinable_string,Apache-2.0 OR MIT,Nick Fitzgerald <fitzgen@gmail.com>
189180
ipnet,https://github.com/krisprice/ipnet,MIT OR Apache-2.0,Kris Price <kris@krisprice.nz>
@@ -235,7 +226,6 @@ miniz_oxide,https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide,MIT OR
235226
mintex,https://github.com/garypen/mintex,Apache-2.0,garypen <garypen@gmail.com>
236227
mio,https://github.com/tokio-rs/mio,MIT,"Carl Lerche <me@carllerche.com>, Thomas de Zeeuw <thomasdezeeuw@gmail.com>, Tokio Contributors <team@tokio.rs>"
237228
multimap,https://github.com/havarnov/multimap,MIT OR Apache-2.0,Håvar Nøvik <havar.novik@gmail.com>
238-
mutants,https://github.com/sourcefrog/cargo-mutants,MIT,The mutants Authors
239229
ndarray,https://github.com/rust-ndarray/ndarray,MIT OR Apache-2.0,"Ulrik Sverdrup ""bluss"", Jim Turner"
240230
nix,https://github.com/nix-rust/nix,MIT,The nix Authors
241231
nohash-hasher,https://github.com/paritytech/nohash-hasher,Apache-2.0 OR MIT,Parity Technologies <admin@parity.io>
@@ -460,7 +450,6 @@ unicode-segmentation,https://github.com/unicode-rs/unicode-segmentation,MIT OR A
460450
unicode-width,https://github.com/unicode-rs/unicode-width,MIT OR Apache-2.0,"kwantam <kwantam@gmail.com>, Manish Goregaokar <manishsmail@gmail.com>"
461451
unicode-xid,https://github.com/unicode-rs/unicode-xid,MIT OR Apache-2.0,"erick.tryzelaar <erick.tryzelaar@gmail.com>, kwantam <kwantam@gmail.com>, Manish Goregaokar <manishsmail@gmail.com>"
462452
unsafe-libyaml,https://github.com/dtolnay/unsafe-libyaml,MIT,David Tolnay <dtolnay@gmail.com>
463-
unsynn,https://seed.pipapo.org/nodes/seed.pipapo.org/rad:z39WbeupErKS8TwbDS5yU8eZSa3C,MIT OR Apache-2.0,Christian Thäter <ct@pipapo.org>
464453
untrusted,https://github.com/briansmith/untrusted,ISC,Brian Smith <brian@briansmith.org>
465454
url,https://github.com/servo/rust-url,MIT OR Apache-2.0,The rust-url developers
466455
utf8-width,https://github.com/magiclen/utf8-width,MIT,Magic Len <len@magiclen.org>

lib/saluki-components/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ datadog-agent-config = { workspace = true }
2929
datadog-agent-metrics-v3 = { workspace = true }
3030
datadog-protos = { workspace = true }
3131
ddsketch = { workspace = true }
32-
facet = { workspace = true }
3332
faster-hex = { workspace = true }
3433
figment = { workspace = true }
3534
float-cmp = { workspace = true, features = ["ratio"] }

lib/saluki-components/src/common/datadog/config.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::time::Duration;
22

33
use agent_data_plane_config::shared::{Endpoints, MetricsEncoding};
4-
use facet::Facet;
54
use saluki_config::{DurationString, GenericConfiguration};
65
use saluki_error::GenericError;
76
use saluki_io::net::client::http::{HttpProtocol, TlsMinimumVersion};
@@ -83,7 +82,7 @@ fn min_tls_version_from_config_value(value: &str) -> TlsMinimumVersion {
8382

8483
/// HTTP protocol selection for the Datadog forwarder.
8584
#[repr(u8)]
86-
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Facet)]
85+
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq)]
8786
#[serde(rename_all = "lowercase")]
8887
#[cfg_attr(test, derive(serde::Serialize))]
8988
pub enum ForwarderHttpProtocol {
@@ -109,7 +108,7 @@ impl From<ForwarderHttpProtocol> for HttpProtocol {
109108
/// The Agent exposes this override under two top-level sections -- `observability_pipelines_worker`
110109
/// and its deprecated `vector` predecessor -- so this struct is flattened by its owner to read both
111110
/// from the same root.
112-
#[derive(Clone, Default, Deserialize, Facet)]
111+
#[derive(Clone, Default, Deserialize)]
113112
#[cfg_attr(test, derive(Debug, PartialEq, serde::Serialize))]
114113
pub(crate) struct OpwMetricsConfiguration {
115114
/// Observability Pipelines Worker routing settings.
@@ -124,7 +123,7 @@ pub(crate) struct OpwMetricsConfiguration {
124123
}
125124

126125
/// One routing target's `metrics` section.
127-
#[derive(Clone, Default, Deserialize, Facet)]
126+
#[derive(Clone, Default, Deserialize)]
128127
#[cfg_attr(test, derive(Debug, PartialEq, serde::Serialize))]
129128
pub(crate) struct OpwMetricsSection {
130129
/// Metrics routing settings for this target.
@@ -133,7 +132,7 @@ pub(crate) struct OpwMetricsSection {
133132
}
134133

135134
/// The routing settings themselves.
136-
#[derive(Clone, Default, Deserialize, Facet)]
135+
#[derive(Clone, Default, Deserialize)]
137136
#[cfg_attr(test, derive(Debug, PartialEq, serde::Serialize))]
138137
pub(crate) struct OpwMetricsSettings {
139138
/// Enables routing all metrics to this target.
@@ -154,7 +153,7 @@ pub(crate) struct OpwMetricsSettings {
154153
}
155154

156155
/// The `use_v3_api` sub-section of a routing target's metrics settings.
157-
#[derive(Clone, Default, Deserialize, Facet)]
156+
#[derive(Clone, Default, Deserialize)]
158157
#[cfg_attr(test, derive(Debug, PartialEq, serde::Serialize))]
159158
pub(crate) struct OpwUseV3ApiSettings {
160159
/// Enables V3 series metrics when routing to this target.
@@ -235,7 +234,7 @@ impl OpwMetricsConfiguration {
235234
/// This adapter provides a simple way to utilize the existing configuration values that are passed to the Datadog
236235
/// Agent, which are used to control the behavior of its forwarder, such as retries and concurrency, in conjunction with
237236
/// with existing primitives, as such retry policies in [`saluki_io::util::retry`].
238-
#[derive(Clone, Deserialize, Facet)]
237+
#[derive(Clone, Deserialize)]
239238
#[cfg_attr(test, derive(Debug, PartialEq, serde::Serialize))]
240239
pub struct ForwarderConfiguration {
241240
/// Maximum number of concurrent requests for an individual endpoint.
@@ -351,7 +350,6 @@ pub struct ForwarderConfiguration {
351350

352351
/// Parsed minimum TLS protocol version for Datadog intake forwarding.
353352
#[serde(skip)]
354-
#[facet(opaque)]
355353
parsed_min_tls_version: TlsMinimumVersion,
356354

357355
/// Timeout for completing the TLS handshake after a connection is established, for Datadog intake forwarding.
@@ -360,7 +358,6 @@ pub struct ForwarderConfiguration {
360358
/// bounds the entire request. A value of `0` disables the handshake deadline entirely, matching the core Agent
361359
/// convention for this setting.
362360
#[serde(default = "default_tls_handshake_timeout")]
363-
#[facet(opaque)]
364361
tls_handshake_timeout: DurationString,
365362

366363
/// Whether to signal that the backend should allow arbitrary tag values.

lib/saluki-components/src/common/datadog/data_plane.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
//! actually reads: a struct that also accepted unrelated `data_plane` keys would silently change
66
//! shape when one of them is set, which the configuration smoke tests treat as a defect.
77
8-
use facet::Facet;
98
use serde::Deserialize;
109

1110
/// The `data_plane` keys read by a payload encoder.
12-
#[derive(Clone, Debug, Default, Deserialize, Facet)]
11+
#[derive(Clone, Debug, Default, Deserialize)]
1312
#[cfg_attr(test, derive(PartialEq, serde::Serialize))]
1413
pub(crate) struct EncoderDataPlaneConfiguration {
1514
/// ADP-specific zstd compression level, taking precedence over the Core Agent's

lib/saluki-components/src/common/datadog/endpoints.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::{
44
sync::LazyLock,
55
};
66

7-
use facet::Facet;
87
use http::uri::Authority;
98
use regex::Regex;
109
use saluki_config::GenericConfiguration;
@@ -359,11 +358,11 @@ pub(crate) enum EndpointError {
359358
}
360359

361360
#[serde_as]
362-
#[derive(Clone, Debug, Default, Deserialize, Facet)]
361+
#[derive(Clone, Debug, Default, Deserialize)]
363362
#[cfg_attr(test, derive(PartialEq, serde::Serialize))]
364363
struct APIKeys(#[serde_as(as = "OneOrMany<_>")] Vec<String>);
365364

366-
#[derive(Clone, Debug, Default, Deserialize, Facet)]
365+
#[derive(Clone, Debug, Default, Deserialize)]
367366
#[cfg_attr(test, derive(PartialEq, serde::Serialize))]
368367
struct MappedAPIKeys(HashMap<String, APIKeys>);
369368

@@ -397,7 +396,7 @@ impl std::fmt::Display for MappedAPIKeys {
397396
///
398397
/// Each endpoint can be associated with multiple API keys. Requests will be forwarded to each unique endpoint/API key pair.
399398
#[serde_as]
400-
#[derive(Clone, Debug, Default, Deserialize, Facet)]
399+
#[derive(Clone, Debug, Default, Deserialize)]
401400
#[cfg_attr(test, derive(PartialEq, serde::Serialize))]
402401
pub(crate) struct AdditionalEndpoints(#[serde_as(as = "PickFirst<(DisplayFromStr, _)>")] MappedAPIKeys);
403402

@@ -457,7 +456,7 @@ impl AdditionalEndpoints {
457456
}
458457

459458
/// Endpoint configuration for sending payloads to the Datadog platform.
460-
#[derive(Clone, Deserialize, Facet)]
459+
#[derive(Clone, Deserialize)]
461460
#[cfg_attr(test, derive(Debug, PartialEq, serde::Serialize))]
462461
pub struct EndpointConfiguration {
463462
/// The API key to use.

0 commit comments

Comments
 (0)