bugsnag / bugsnag-python

Official BugSnag error monitoring and error reporting for django, flask, tornado and other python apps.
https://docs.bugsnag.com/platforms/python/
MIT License
84 stars 42 forks source link

Track in flight requests #376

Closed imjoehaines closed 5 months ago

imjoehaines commented 5 months ago

Goal

This PR adds a RequestTracker class that can be used to (surprise surprise) track requests:

request_tracker = RequestTracker()
mark_request_complete = request_tracker.new_request()
request_tracker.has_in_flight_requests() # => True

# ...make the request...

mark_request_complete()
request_tracker.has_in_flight_requests() # => False

The Client and SessionTracker use this, along with post-delivery callbacks (#375), to keep track of when there are in-flight event or session requests