Skip to content
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

Add support for Windows Named Pipe #43

Merged
merged 5 commits into from
Aug 24, 2022
Merged

Conversation

gleocadie
Copy link
Contributor

@gleocadie gleocadie commented Aug 24, 2022

What does this PR do?

This PR adds support for the Windows Named Pipe.

Motivation

The .NET tracer currently runs in environment (AAS) where traces are sent to the agent through windows named pipe. The customers that have their apps in that environment are waiting for the profiler to work there too.

Additional Notes

Not on top of my head

How to test the change?

  • I build a custom version of libdatadog, linked it to the compiler.
  • Implement support for named pipe in the profiler
  • Setup the datadog agent to listen on windows named pipe by setting the environment variable DD_APM_WINDOWS_PIPE_NAME to \\.\pipe\datadogpipe\mypipe
  • Run the application

I check the profiler log and I saw the agent url is the named pipe:
[2022-08-23 22:01:41.691 | info | PId: 421300 | TId: 411900] Using agent endpoint windows:\\.\pipe\datadogpipe\mypipe

And saw in the dashboard my profiles:
image (16)

@gleocadie gleocadie force-pushed the gleocadie/add-named-pipe-support branch from 9ea26f3 to ba663aa Compare August 24, 2022 08:53
@gleocadie gleocadie changed the title Add support for named pipe Add support for Windows Named Pipe Aug 24, 2022
@gleocadie gleocadie marked this pull request as ready for review August 24, 2022 09:29
@gleocadie gleocadie requested a review from a team as a code owner August 24, 2022 09:29
@gleocadie gleocadie force-pushed the gleocadie/add-named-pipe-support branch from ab695b4 to 0a12c7c Compare August 24, 2022 09:36
Copy link
Contributor

@paullegranddc paullegranddc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

}

pub type ConnStreamError = Box<dyn std::error::Error + Send + Sync>;

use hyper::{client::HttpConnector, service::Service};
impl ConnStream {
pub async fn from_uds_uri(uri: hyper::Uri) -> Result<ConnStream, ConnStreamError> {
pub async fn from_uds_uri(_uri: hyper::Uri) -> Result<ConnStream, ConnStreamError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you put _uri here because of unused warnings when compiling on #[cfg(not(unix))?

If yes, I'd rather put something like

#[cfg(not(unix))]
{
    let _ = uri;
    Err(super::errors::Error::UnixSocketUnsupported.into())
}

Because when I see underscored variables in function signatures, I assume the value will. be unused which is not always the case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah exactly. Sorry for that, I'm a beginner in Rust.
Thanks, I'll fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in c9ee643

Copy link
Contributor

@morrisonlevi morrisonlevi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know nothing about Windows, but if it works for you, this looks fine to me!

@gleocadie
Copy link
Contributor Author

I know nothing about Windows, but if it works for you, this looks fine to me!

We will put some tests in our hand with named pipe to ensure that it works accordingly (once released)

@gleocadie gleocadie merged commit f074996 into main Aug 24, 2022
@morrisonlevi morrisonlevi deleted the gleocadie/add-named-pipe-support branch January 27, 2023 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants