KumoCorp / kumomta

The first Open-Source high-performance MTA developed from the ground-up for high-volume email sending environments.
https://kumomta.com
Apache License 2.0
204 stars 25 forks source link

Add inspect-ready-q and inspect-scheduled-q HTTP API endpoints #231

Open edgarsendernet opened 2 weeks ago

edgarsendernet commented 2 weeks ago

Having the ability to quickly see queue configuration would be very helpful when managing and tuning KumoMTA. Parameters:

Response would contain:

wez commented 2 weeks ago

The system is not optimized for that kind of per-message observation. To enable it will require data structure changes that will harm the maximum throughput of the system, which is undesirable.

The closest approximation would be to schedule some work to de-queue some number of messages from matching queue(s) and apply some function to them, and then re-insert them into the queues again afterwards.

You could sort of do this for yourself today using the rebind API and trigger_rebind_event = true to pass every message in the queue to a lua function. It's not an ideal match up today because there isn't really a way to share state, limit the number of matches or return scoped output from that event.

Querying other metadata about the queues overall is more easily doable without imposing a performance cost on the rest of the system.

edgarsendernet commented 2 weeks ago

I was thinking to implement this without changing the underlying timeq queues, as it's needed only when investigating something. Basic idea would be to clone the requested queue, then .skip() some amount of ms (maybe max message age) so that all the entries become due, and then return any entries up to specified limit. Not sure if that makes sense?