-
Notifications
You must be signed in to change notification settings - Fork 9
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
refactor: ddcommon-net+profiling with hyper 1 #748
base: main
Are you sure you want to change the base?
Conversation
dc5aeaa
to
8c09a72
Compare
Cargo.toml
Outdated
@@ -37,7 +37,7 @@ members = [ | |||
"data-pipeline-ffi", | |||
"ddsketch", | |||
"tinybytes", | |||
"dogstatsd-client", | |||
"dogstatsd-client", "ddcommon-net", |
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.
formatting
ddcommon = { path = "../ddcommon" } | ||
hex = { version = "0.4" } | ||
http = { version = "1" } | ||
hyper = { version = "1", default-features = false } |
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.
💯
use std::borrow::Cow; | ||
use std::ops::Deref; | ||
|
||
// todo: why do we need to serialize and deserialize endpoints? |
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 believe crashtracker uses this: we spawn a collector, and then tell it where to send data by sending a Config
struct as json over a pipe.
ddcommon-net/src/compat.rs
Outdated
Self { | ||
url: uri, | ||
api_key: None, | ||
timeout_ms: 0, |
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.
Should this be DEFAULT_TIMEOUT
?
profiling/src/exporter/config.rs
Outdated
api_key: Some(api_key.into()), | ||
..Default::default() | ||
}) | ||
pub trait ProfilingEndpoint { |
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.
Why is this a trait?
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.
It's the "extension" trait pattern to add new methods to existing types. In this case, Endpoint::profiling_agent
. We don't have to do it this way. Is there something else you would prefer?
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 renamed this to EndpointExt
to hopefully be more clear about that.
Some(scheme) => match scheme.as_str() { | ||
"http" => send_http(request).await, | ||
"https" => send_https(request).await, | ||
#[cfg(unix)] |
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.
Do we eventually want to support this on Windows? https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #748 +/- ##
==========================================
- Coverage 70.47% 70.12% -0.36%
==========================================
Files 297 300 +3
Lines 43411 43658 +247
==========================================
+ Hits 30594 30613 +19
- Misses 12817 13045 +228
|
What does this PR do?
ddcommon-net
, naming suggestions welcome. It has bits ofddcommon
networking code which have been upgraded to hyper 1. Note it's not a direct 1:1 because hyper 1 changed a lot.datadog-profiling
crate has been updated to use it. Currently its tests pass for me locally. Thedatadog-profiling-ffi
is currently broken.Motivation
The main motivation is to upgrade hyper from v0.14 to v1. There are a lot of changes when moving to v1. Some things do not have direct replacements, so upgrading all crates at once is difficult. I decided (with input from a few others) that it seemed sensible to try making a
ddcommon-net
crate that uses hyper 1, and then crates can migrate one-by-one fromddcommon
toddcommon-net
.Additional Notes
Please tell me if you have concerns about the approach, technical or otherwise. Here are some of mine:
datadog-profiling
is the only crate using this for now, isddcommon-net
really going to be common? Maybe we should make anet
module inside ofdatadog-profiling
instead and only extract a crate when there is at least one other crate migrated to hyper 1?ddcommon-net::compat
andddcommon
, mostly around Uri and Endpoint related things. Probably okay, not sure.How to test the change?
Don't. This is a WIP, I'll update this when it's ready for testing.