feat: implement catchall middleware#19
feat: implement catchall middleware#19NiklasMerz wants to merge 4 commits intoplathanus-tech:masterfrom
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