Skip to content

Commit 1c181be

Browse files
chore(deps): bump libdatadog to 48da0d8 for client-computed header fix (#1244)
## Overview Bump all `libdd-*` dependencies from `db05e1f` to `48da0d8` to pick up [libdatadog PR #2071](DataDog/libdatadog#2071), which fixes how the `datadog-client-computed-stats` and `datadog-client-computed-top-level` headers are parsed so the behavior matches the Go trace-agent. Bottlecap consumes this exact path in `bottlecap/src/traces/trace_agent.rs` via `(&parts.headers).into()`, so it directly benefits from the fix. ### Adapting to breaking API changes between the two revisions - `HttpClientTrait` was renamed to `HttpClientCapability` - `SendData::send` now requires `C: HttpClientCapability + SleepCapability`, so implemented `SleepCapability` for `HttpClient` ### Testing Added Tier 0 coverage in `trace_agent.rs` pinning the new header-parsing behavior at the `(&headers).into()` boundary `handle_traces` uses: - `true`, `yes`, `t`, `1` -> flag set - `false`, `0`, `f`, `F`, `FALSE`, `False` -> flag clear - absent/empty -> clear - `client_computed_top_level` no longer set by presence alone (pre-bump regression) These test would fail on the pre-bump rev (`db05e1f`), so they lock in the fix. > *"Turns out `yes` means yes and `false` means false. Took a whole PR to teach the parser what every toddler already knows."* — Claude 🤖 [APMSVLS-487](https://datadoghq.atlassian.net/browse/APMSVLS-487) [APMSVLS-487]: https://datadoghq.atlassian.net/browse/APMSVLS-487?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 06d0872 commit 1c181be

5 files changed

Lines changed: 171 additions & 54 deletions

File tree

bottlecap/Cargo.lock

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

bottlecap/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ indexmap = {version = "2.11.0", default-features = false}
7474
# be found in the clippy.toml file adjacent to this Cargo.toml.
7575
datadog-protos = { version = "0.1.0", default-features = false, git = "https://github.com/DataDog/saluki/", rev = "f863626dbfe3c59bb390985fa6530b0621c2a0a2"}
7676
ddsketch-agent = { version = "0.1.0", default-features = false, git = "https://github.com/DataDog/saluki/", rev = "f863626dbfe3c59bb390985fa6530b0621c2a0a2"}
77-
libdd-capabilities = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57" }
78-
libdd-common = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57", default-features = false }
79-
libdd-trace-protobuf = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57" }
80-
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57", default-features = false, features = ["mini_agent"] }
81-
libdd-trace-normalization = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57" }
82-
libdd-trace-obfuscation = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57", default-features = false }
83-
libdd-trace-stats = { git = "https://github.com/DataDog/libdatadog", rev = "db05e1f8408a76075efb37ecec544d2e74217e57", default-features = false }
77+
libdd-capabilities = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03" }
78+
libdd-common = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03", default-features = false }
79+
libdd-trace-protobuf = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03" }
80+
libdd-trace-utils = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03", default-features = false, features = ["mini_agent"] }
81+
libdd-trace-normalization = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03" }
82+
libdd-trace-obfuscation = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03", default-features = false }
83+
libdd-trace-stats = { git = "https://github.com/DataDog/libdatadog", rev = "48da0d82cb32b43d4cdece35b794c9bcbc275a03", default-features = false }
8484
datadog-opentelemetry = { git = "https://github.com/DataDog/dd-trace-rs", rev = "f51cefc4ad24bec81b38fb2f36b1ed93f21ae913", default-features = false }
8585
dogstatsd = { git = "https://github.com/DataDog/serverless-components", rev = "5b68f50f49c9defbfed4d25bd621e2a86405a972", default-features = false }
8686
datadog-fips = { git = "https://github.com/DataDog/serverless-components", rev = "5b68f50f49c9defbfed4d25bd621e2a86405a972", default-features = false }

bottlecap/src/traces/http_client.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use hyper_http_proxy;
1111
use hyper_rustls::HttpsConnectorBuilder;
1212
use libdd_capabilities::{
1313
MaybeSend,
14-
http::{HttpClientTrait, HttpError},
14+
http::{HttpClientCapability, HttpError},
15+
sleep::SleepCapability,
1516
};
1617
use libdd_common::http_common::{self, Body, GenericHttpClient};
1718
use rustls::RootCertStore;
@@ -21,6 +22,7 @@ use std::fs::File;
2122
use std::future::Future;
2223
use std::io::BufReader;
2324
use std::sync::{Arc, LazyLock};
25+
use std::time::Duration;
2426
use tracing::debug;
2527

2628
type InnerClient =
@@ -29,8 +31,8 @@ type InnerClient =
2931
/// HTTP client used by trace and stats flushers.
3032
///
3133
/// Wraps a hyper client preconfigured with optional proxy and TLS settings, and
32-
/// implements [`HttpClientTrait`] so it can be passed to `libdd_trace_utils`
33-
/// senders such as `SendData::send`.
34+
/// implements [`HttpClientCapability`] and [`SleepCapability`] so it can be
35+
/// passed to `libdd_trace_utils` senders such as `SendData::send`.
3436
#[derive(Clone, Debug)]
3537
pub struct HttpClient {
3638
inner: InnerClient,
@@ -42,10 +44,10 @@ impl HttpClient {
4244
}
4345
}
4446

45-
impl HttpClientTrait for HttpClient {
47+
impl HttpClientCapability for HttpClient {
4648
#[allow(clippy::expect_used)]
4749
fn new_client() -> Self {
48-
// Required by `HttpClientTrait` but never invoked on bottlecap's code
50+
// Required by `HttpClientCapability` but never invoked on bottlecap's code
4951
// paths — production builds the client via
5052
// `create_client(proxy, tls_cert, skip_ssl)`. Routing this fallback
5153
// through the same constructor keeps the failure mode and error
@@ -76,6 +78,20 @@ impl HttpClientTrait for HttpClient {
7678
}
7779
}
7880

81+
impl SleepCapability for HttpClient {
82+
fn new() -> Self {
83+
// Required by `SleepCapability` but never invoked on bottlecap's code
84+
// paths — production builds the client via
85+
// `create_client(proxy, tls_cert, skip_ssl)`. Mirror `new_client()` so
86+
// the failure mode stays consistent with the rest of the module.
87+
<Self as HttpClientCapability>::new_client()
88+
}
89+
90+
fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend {
91+
tokio::time::sleep(duration)
92+
}
93+
}
94+
7995
/// Initialize the crypto provider needed for setting custom root certificates.
8096
fn ensure_crypto_provider_initialized() {
8197
static INIT_CRYPTO_PROVIDER: LazyLock<()> = LazyLock::new(|| {

bottlecap/src/traces/stats_flusher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::traces::http_client::HttpClient;
1313
use crate::traces::stats_aggregator::StatsAggregator;
1414
use bytes::Bytes;
1515
use dogstatsd::api_key::ApiKeyFactory;
16-
use libdd_capabilities::http::HttpClientTrait;
16+
use libdd_capabilities::http::HttpClientCapability;
1717
use libdd_common::Endpoint;
1818
use libdd_trace_protobuf::pb;
1919
use libdd_trace_utils::stats_utils;

0 commit comments

Comments
 (0)