-
Notifications
You must be signed in to change notification settings - Fork 16
refactor(profiling)!: use reqwest instead of hyper for exporter #1444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6743cb4 to
ec85a33
Compare
BenchmarksComparisonBenchmark execution time: 2026-01-13 17:46:15 Comparing candidate commit 779821f in PR branch Found 15 performance improvements and 0 performance regressions! Performance is the same for 42 metrics, 2 unstable metrics. scenario:benching serializing traces from their internal representation to msgpack
scenario:credit_card/is_card_number/ 378282246310005
scenario:credit_card/is_card_number/378282246310005
scenario:credit_card/is_card_number/37828224631000521389798
scenario:credit_card/is_card_number_no_luhn/ 3782-8224-6310-005
scenario:credit_card/is_card_number_no_luhn/ 378282246310005
scenario:credit_card/is_card_number_no_luhn/378282246310005
scenario:credit_card/is_card_number_no_luhn/37828224631000521389798
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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1444 +/- ##
==========================================
+ Coverage 71.30% 71.36% +0.06%
==========================================
Files 413 413
Lines 66157 66158 +1
==========================================
+ Hits 47172 47216 +44
+ Misses 18985 18942 -43
🚀 New features to boost your workflow:
|
ec85a33 to
5b427a1
Compare
5b427a1 to
779821f
Compare
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-apple-darwin
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-apple-darwin
x86_64-unknown-linux-gnu
|
taegyunkim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me, though my knowledge on Rust/async/tokio is somewhat limited.
| hyper = { workspace = true} | ||
| http-body-util = "0.1" | ||
| httparse = "1.9" | ||
| hyper = { workspace = true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this?
| /// [`send`]: ProfileExporter::send | ||
| #[allow(clippy::too_many_arguments)] | ||
| pub fn send_blocking( | ||
| &mut self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question I had in mind was why would this need to take self as mutable.
It's modifying self.runtime, and consulting with claude suggested using OnceLock but turns out that it won't be thread-safe given that we use new_current_thread().
Correct me, if my understanding is wrong.
| process_tags: Option<&str>, | ||
| cancel: Option<&CancellationToken>, | ||
| ) -> anyhow::Result<reqwest::StatusCode> { | ||
| if self.runtime.is_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super familiar with programming in async/tokio, so also asked why it's necessary to create runtime only from send_blocking()
the async version send() expects the runtime to created by the caller, and it's only called from tests in this PR. The tests are marked using #[tokio::test] which provides a runtime.
send_blocking() is typically called from language runtimes via ffi layer, so it needs to create one to call send()
morrisonlevi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to review in depth still but I noticed the artifacts came up in size a fair bit. Maybe there's something we can do to trim it back down? Maybe features we can disable?
What does this PR do?
Uses reqwest instead of hyper for the profiler exporter.
Motivation
Using a high-level library rather than low-level networking makes the code clearer.
Additional Notes
Technically a breaking change since we change Rust APIs but we don't affect the FFI at all.
How to test the change?
Existing tests, plus a new end to end set of tests for the different endpoint types