-
Notifications
You must be signed in to change notification settings - Fork 13
Implement sending via sidecar #192
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
Conversation
19dbffb
to
77b60c1
Compare
e5b7de2
to
85bb04e
Compare
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.
Thanks for doing the re-factoring, I really like how you abstracted common logic. I left a couple questions regarding some stuff I wasn't clear on.
}; | ||
|
||
send_request(req, serialized_trace_payload, StatusCode::ACCEPTED).await | ||
} else { |
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.
Could you explain this else block to me? Is it for sending traces to the trace agent from within the sidecar?
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.
Yes :-)
The Agent just takes individual collections of trace chunk, not a whole payload.
trace-utils/src/trace_utils.rs
Outdated
pub fn serialize_agent_payload(payload: pb::AgentPayload) -> anyhow::Result<Vec<u8>> { | ||
pub fn serialize_proto_payload<T>(payload: T) -> anyhow::Result<Vec<u8>> | ||
where | ||
T: ::prost::Message, |
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.
just a general rust question, but what's the purpose of the prefix ::
in ::prost::Message
? Is this a stylistic choice, as it seems like it would work without it?
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 be probably removed, I believe, I copied it from the generated protobuf files (where it's done to avoid conflicts...).
trace-utils/src/trace_utils.rs
Outdated
|
||
let mut req = hyper::Request::builder() | ||
.uri(target.url.clone()) | ||
.header(hyper::header::USER_AGENT, concat!("Tracer/", env!("CARGO_PKG_VERSION"))) |
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.
what's this header used for?
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.
Telemetry and profiler use the header to clearly distinguish which code is the sender, in case some things are observed on the receiving side so that it's obvious what code sends it.
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.
looks good on the serverless end, thanks for the refactoring!
c17b1f1
to
2cbbe1e
Compare
} | ||
} | ||
|
||
camel_ty.shrink_to_fit(); |
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.
Is this necessary? I'd think that in term of perf the reallocation is worse than few extra bytes
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.
This is macro-code though, so just compile time overhead.
857284f
to
33705f1
Compare
Signed-off-by: Bob Weinand <[email protected]>
@paullegranddc Thanks for the review. I've addressed the comments in the newest commit. Also rebased on main to fix conflicts. The only remaining question is: this CI failure https://github.com/DataDog/libdatadog/actions/runs/5751516424/job/15590430623?pr=192 |
33705f1
to
a0a697d
Compare
I think this is because you updated to nix 0.26 which calls to The maintainers are aware of the issue but it seems like they don't want to fix it nix-rust/nix#1972 Can you use nix 0.24 in the sidecar crate? (which is already used by the spawn_worker crate by the way) |
Another option they propose in the nix repo thread is to use full LTO for all builds, so that the code calling to libc::memfd_create is removed as dead code before the linking process since it does everything in a single compilation unit. Or we could disable the memfd code on centos like we do for non linux os using features? |
02b8f4e
to
6363b02
Compare
I'm not even using the memfd thing from nix. Trying to disable with features seemingly did not help, even though it's the fs feature if I see that correctly, which isn't used? |
b697a6f
to
604b76e
Compare
Signed-off-by: Bob Weinand <[email protected]>
604b76e
to
e9f2698
Compare
sidecar/src/agent_remote_config.rs
Outdated
|
||
// Ensure the next write hasn't started yet *and* the data is from the expected generation | ||
if !new_data.meta.writing.load(Ordering::SeqCst) | ||
&& new_generation == copied_data.meta.generation.load(Ordering::Acquire) |
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.
If you want to check that no new generation has happened while you were writing, you should probably load the the atomic here instead of relying on the one read at the beginning of the function.
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.
The code was using the wrong data as source, needs to be new_data - the goal is checking whether the initial generation before I start copying is identical to the one after copying.
Signed-off-by: Bob Weinand <[email protected]>
6794d7c
to
c46f5a3
Compare
* Implemented tracing and agent sampling in sidecar * Address CR feedback Signed-off-by: Bob Weinand <[email protected]> * Polyfill memfd on old glibc targets Signed-off-by: Bob Weinand <[email protected]> * Small nit from CR applied Signed-off-by: Bob Weinand <[email protected]> --------- Signed-off-by: Bob Weinand <[email protected]>
What does this PR do?
impl TransferHandles for ExampleInterfaceRequest
, for both, which is just trivial boilerplate. The macro makes it explicit in the service definition what is passed.The changes to the sidecar crate have been tested and validated in the dd-trace-php repository.
I'm aware the PR is quite big, but everything needed to come together to do proper end-to-end testing.