AttributeError: 'Request' object has no attribute 'prom_start_time'
See original GitHub issuebefore_request
from export_defaults()
is not guaranteed to run if some other before_request
hook raises exception, for example for authentication.
Therefore, when after_request
is triggered request.prom_start_time
might not be set.
Suggested fix would be to skip the histogram section in after_request
if request
has no prom_start_time
attribute.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s an amazing turn-around time, thank you!
Yes, I’m sorry, I should have elaborated. an unhandled exception will of course just crash in the before_request hook, but if the exception is handled by the app (or flask)
before_request
handlers which are unlucky enough to be processed after that one won’t get called, butafter_request
handlers will be called as usual.Minimal example here:
navigate to http://localhost:8080 and you should get this error: