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

fix(tracing): use tracing instrument macro #846

Merged
merged 13 commits into from
Sep 16, 2022

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Aug 3, 2022

Closes #844

It relies on instrument macro so we don't have to bother thinking about whether it's async or sync context :)
I introduced a few bugs related that in the past and hopefully never again now

http-server/src/server.rs Outdated Show resolved Hide resolved
ws-server/src/server.rs Outdated Show resolved Hide resolved
@niklasad1 niklasad1 changed the title [WIP]: use tracing instrument macro fix(tracing): use tracing instrument macro Aug 16, 2022
@niklasad1 niklasad1 marked this pull request as ready for review August 16, 2022 14:42
@niklasad1 niklasad1 requested a review from a team as a code owner August 16, 2022 14:42
@@ -267,7 +251,7 @@ pub(crate) async fn execute_call<L: Logger>(c: Call<'_, L>) -> MethodResult {

let r = response.as_inner();

rx_log_from_str(&r.result, max_log_length);
tx_log_from_str(&r.result, max_log_length);
Copy link
Member Author

Choose a reason for hiding this comment

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

ooops, bug fix :P

fn execute_notification(notif: Notif, max_log_length: u32) -> MethodResponse {
rx_log_from_json(&notif, max_log_length);
let response = MethodResponse { result: String::new(), success: true };
tx_log_from_str(&response.result, max_log_length);
Copy link
Member Author

Choose a reason for hiding this comment

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

this is silly it would just be an empty string but yeye for consistency

Copy link
Collaborator

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

Nice!

@niklasad1 niklasad1 merged commit 1efd5ae into master Sep 16, 2022
@niklasad1 niklasad1 deleted the na-use-tracing-instrument-macro branch September 16, 2022 16:12
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.

[tracing]: refactor to use tracing attribute macros for ease of use
3 participants