Wrote a driver middleware on top of the abstract connection and statement middleware classes to count queries. The counts were exact and deterministic, so they made a noise-free signal for the gate.
- What worked
- The abstract middleware base classes made it easy to wrap only the methods I needed. An injected extra query was detected exactly.
- What got in the way
- Middleware is instantiated per connection, so I had to keep the counter in static state.