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 tokio tracing for actix Service. #86

Merged
merged 5 commits into from
Jan 15, 2020

Conversation

avranju
Copy link
Contributor

@avranju avranju commented Jan 12, 2020

No description provided.

@codecov
Copy link

codecov bot commented Jan 12, 2020

Codecov Report

Merging #86 into master will increase coverage by 0.25%.
The diff coverage is 71.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
+ Coverage   58.38%   58.64%   +0.25%     
==========================================
  Files          75       76       +1     
  Lines        4881     4967      +86     
==========================================
+ Hits         2850     2913      +63     
- Misses       2031     2054      +23
Impacted Files Coverage Δ
actix-tracing/src/lib.rs 71.23% <71.23%> (ø)
string/src/lib.rs 77.63% <0%> (+1.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4bbba80...7b93c3c. Read the comment docs.

@JohnTitor
Copy link
Member

I'm not sure this should be in actix-net, not third-party crate. CC @fafhrd91

@fafhrd91
Copy link
Member

I asked Raj to add it to actix-net

actix-tracing/src/lib.rs Outdated Show resolved Hide resolved
/// Creates a new span for the given request value.
///
/// By default, this function returns `None`.
fn span_for(&self, _req: &T) -> Option<tracing::Span> {
Copy link
Member

Choose a reason for hiding this comment

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

should be required method, no reason for default impl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree.

pub fn trace<S, U, T>(
service_factory: U,
make_span: T,
) -> impl ServiceFactory<
Copy link
Member

Choose a reason for hiding this comment

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

it won't be possible to use +Clone with impl Trait here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I understand this. I was able to add a Clone bound on the Fn.

Copy link
Member

Choose a reason for hiding this comment

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

Resulted factory wouldn’t have clone even if input service factory would have clone

Copy link
Member

Choose a reason for hiding this comment

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

Let’s return ApplyTransform type instead of impl ServiceFactory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the return type to ApplyTransform.

Still don't understand the Clone comment. The Clone bound is on the closure and not on the factory returned from trace.

Copy link
Member

Choose a reason for hiding this comment

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

but if you want to make clonable service factory, it would be not possible with impl Trait

@fafhrd91 fafhrd91 merged commit aed5fec into actix:master Jan 15, 2020
@fafhrd91
Copy link
Member

thanks!

@cdbattags
Copy link
Member

Any documentation yet for using this with actix-web?

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.

4 participants