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

Added route filtering for Owin and AspNetCore middleware #229

Merged
merged 4 commits into from
Mar 18, 2019

Conversation

bstauff
Copy link
Contributor

@bstauff bstauff commented Feb 5, 2019

I modified the Owin and AspNetCore middleware to support a func for route filtering, as requested in #228

=> appBuilder.Use<ZipkinMiddleware>(serviceName, traceExtractor, getRpc);
public static IAppBuilder UseZipkinTracer(this IAppBuilder appBuilder, string serviceName, IExtractor<IHeaderDictionary> traceExtractor, Func<IOwinContext, string> getRpc = null,
Func<PathString, bool> routeFilter = null)
=> appBuilder.Use<ZipkinMiddleware>(serviceName, traceExtractor, getRpc, routeFilter);
Copy link
Contributor

Choose a reason for hiding this comment

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

@bstauff Can we update the line limit to at most 120 so that it will be easier to view all the arguments? No need to scroll.

image

Please apply it on the method below too.

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 eb9be3d

@bvillanueva-mdsol
Copy link
Contributor

@bstauff Thanks for putting this in. This would be helpful to our team and to others I think.

Overall , implementation looks good!
If you have time, can you please add unit test for this? Thank you so much!

@bstauff
Copy link
Contributor Author

bstauff commented Feb 14, 2019

Added a unit test for the owin middleware.

@@ -20,15 +23,18 @@ public static class TracingMiddleware

var trace = traceContext == null ? Trace.Create() : Trace.CreateFromId(traceContext);
Trace.Current = trace;
using (var serverTrace = new ServerTrace(serviceName, getRpc(context)))
if (routeFilter(request.Path))
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the new changes with unit test (thanks for adding), I think you need to add else condition here too.

Copy link
Member

Choose a reason for hiding this comment

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

this is the only blocking change, let's get this in an @bstauff publish!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the delay! Got really busy. I've made the changes, thanks for the catch!

Copy link
Contributor

@bvillanueva-mdsol bvillanueva-mdsol left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks a lot @bstauff

I was wondering if we maintain a readme for using middlewares for both dotnet core and owin. We can add it in issues as a TODO list and be picked up by anyone to contribute.

@jcarres-mdsol
Copy link
Contributor

Thanks!

@jcarres-mdsol jcarres-mdsol merged commit 76cf558 into openzipkin:master Mar 18, 2019
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.

None yet

4 participants