-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: implement catchall middleware #19
base: master
Are you sure you want to change the base?
Conversation
Hey @NiklasMerz, first of all thanks for putting your time into this. |
Good point. In my testing normal class-based views and a function base view with |
Also, this Catch all middleware is only applying the metrics. The Error tracing, you think as a separate middleware? |
I added code to also track DRF requests. Seems to work fine in my project.
Having one Middleware to do everything automagically in the background sounds good to me. I could also extend the |
I think that this Inheritance will make it less clear what the middleware is actually doing. |
I am not entirely sure what you mean, but feel free to refactor my branch as you like. I quite like the inheritance for solving this and making it clear is just a matter of documentation. But the code has to be maintainable, so we can make it as you prefer. |
I added some documentation of the new middleware to README. @leandrodesouzadev What do you think? Do you want to change the code or should I refactor it? |
Little ping @leandrodesouzadev. Is there anything I can do to move this PR forward? |
Hey @NiklasMerz sorry for not giving attention to this. Maybe something like this (haven't tested it): class CatchAllMiddleware:
def __init__(self, get_request):
others = [ApmMetricsMiddleware(get_request), ErrorTraceMiddleware(get_request)]
def __call__(self, request):
for other in others:
other(request) |
Some open todos:
Closes #10