-
-
Notifications
You must be signed in to change notification settings - Fork 271
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 tracing to requests #307
Conversation
Cargo.toml
Outdated
@@ -48,6 +49,7 @@ wiremock = "0.5.3" | |||
[features] | |||
default = ["native-tls"] | |||
rustls = ["rustls-tls"] # Leagcy support (<=0.17.0) | |||
trace = ["tracing"] |
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 shouldn't be needed as by default making tracing optional creates a feature called tracing
.
trace = ["tracing"] |
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 decided to just remove the feature and make it part of the library. Would that be OK?
src/lib.rs
Outdated
@@ -893,6 +899,38 @@ impl Octocrab { | |||
} | |||
} | |||
|
|||
#[cfg(feature = "trace")] |
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.
#[cfg(feature = "trace")] | |
#[cfg(feature = "tracing")] |
src/lib.rs
Outdated
#[cfg(feature = "trace")] | ||
use tracing::{self, field}; | ||
|
||
#[cfg(feature = "trace")] |
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.
#[cfg(feature = "trace")] | |
use tracing::{self, field}; | |
#[cfg(feature = "trace")] | |
#[cfg(feature = "tracing")] | |
use tracing::{self, field}; | |
#[cfg(feature = "tracing")] |
src/lib.rs
Outdated
result | ||
} | ||
|
||
#[cfg(not(feature = "trace"))] |
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.
#[cfg(not(feature = "trace"))] | |
#[cfg(not(feature = "tracing"))] |
Make it a feature so people can opt-in
} | ||
}; | ||
result | ||
} |
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.
Had to pull things out to a sep async function because span
would've moved if I used .instrument(span)
, which then prevents recording fields after the request.
Also, sorry about the few force pushes. Thought I still had some time to do some last minute tweaks. |
Thank you for your PR! |
Make it a feature so people can opt-inDecided to simplify