feat(capabilities): trait architecture http draft#1555
feat(capabilities): trait architecture http draft#1555Aaalibaba42 wants to merge 24 commits intomainfrom
Conversation
📚 Documentation Check Results📦
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality. |
🔒 Cargo Deny Results📦
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1555 +/- ##
==========================================
- Coverage 71.20% 71.14% -0.07%
==========================================
Files 423 425 +2
Lines 62486 62481 -5
==========================================
- Hits 44492 44449 -43
- Misses 17994 18032 +38
🚀 New features to boost your workflow:
|
91daca7 to
b727c1c
Compare
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
b727c1c to
624bdac
Compare
a7a3941 to
3941878
Compare
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🔗 Commit SHA: f44f4cb | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
… for httpresponse
dd6ca9d to
853e0db
Compare
c0843b5 to
280cf5d
Compare
BenchmarksComparisonBenchmark execution time: 2026-02-26 14:51:15 Comparing candidate commit f44f4cb in PR branch Found 11 performance improvements and 6 performance regressions! Performance is the same for 40 metrics, 2 unstable metrics. scenario:credit_card/is_card_number/ 3782-8224-6310-005
scenario:credit_card/is_card_number/ 378282246310005
scenario:credit_card/is_card_number/378282246310005
scenario:credit_card/is_card_number/x371413321323331
scenario:credit_card/is_card_number_no_luhn/x371413321323331
scenario:normalization/normalize_name/normalize_name/good
scenario:normalization/normalize_service/normalize_service/A0000000000000000000000000000000000000000000000000...
scenario:normalization/normalize_service/normalize_service/Test Conversion 0f Weird !@#$%^&**() Characters
scenario:sql/obfuscate_sql_string
CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
Group 14
Group 15
Group 16
Group 17
Group 18
Group 19
BaselineOmitted due to size. |
…pat without complicating wasm effort, and improvements that ensued therein
16a302a to
78b3826
Compare
libdd-trace-utils/src/stats_utils.rs
Outdated
| let default_client = http_common::new_default_client(); | ||
| default_client.request(req).await | ||
| }; | ||
| let client = DefaultHttpClient::new_client(); |
There was a problem hiding this comment.
I don't think that's ok, the reason we passed the http client all the way down here is to allow connection reuse when sending traces, as recreating connections everytime has a pretty big performance impact
There was a problem hiding this comment.
Yep my bad, originally the request method was static and created a new client everytime, then I added the possibility of reusing a client but missed this one to rollback
libdd-capabilities/src/http.rs
Outdated
| Timeout, | ||
| ResponseBody(String), | ||
| InvalidRequest(String), | ||
| Other(String), |
There was a problem hiding this comment.
Good use case for thiserror, also I think having the content of the enum as anyhow::Error rather than String will be slightly more efficient in the happy path as anyhow::Error is a single pointer wide, whereas String is 3 pointer wide.
So the Error type will be smaller
libdd-capabilities-impl/src/http.rs
Outdated
| let (parts, body) = req.into_parts(); | ||
| let hyper_req = hyper::Request::from_parts(parts, http_common::Body::from_bytes(body)); |
There was a problem hiding this comment.
| let (parts, body) = req.into_parts(); | |
| let hyper_req = hyper::Request::from_parts(parts, http_common::Body::from_bytes(body)); | |
| let hyper_req = req.map(http_common::Body::from_bytes) |
libdd-capabilities/Cargo.toml
Outdated
| [dependencies] | ||
| http = "1.0" | ||
| bytes = "1" |
There was a problem hiding this comment.
Consolidated with 1.4 as other crates had.
What does this PR do?
Add capability trait architecture, and few native implementations.
Motivation
Ongoing effort to make libdatadog wasm compatible.
Additional Notes
In the long run, several other parts of the codebase ought to use these capabilities via the provided public structure, so that it can automagically choose the correct underlying implementation when compiling or not to wasm.
How to test the change?
I should add some tests...