Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a WiP PR that adds some experimental tracing support to Bandit in order to facilitate easier diagnosis of ephemeral issues that users report such as #412, #431, #438, and really countless others before them. The idea is to provide a temporary 'trace' mode to Bandit which watches for exceptions (or user triggers) and when such a condition triggers, a dump of all relevant telemetry events is made. The hope is that this should help provide some insight into the causes of such issues, since the telemetry events contain a record of all bytes read/written, along with a bunch of other useful internal states (such as what the Conn & Bandit adapters looked like at each step of the way).
I'm planning on also adding some more untimed Bandit telemetry events at various places in the stacks (reading/writing of HTTP/2 frames, for example) to further enrich these dumps.
I'm not 100% sure that this approach will bear fruit, but there's no better way to try it out than in the real world. @atavistock, would you be able to take a look at the tooling on this branch and see if you'd be able to make use of it in the cases where #438 is happening? You can find useful docs at the top of the
Bandit.Trace
module in this PR.