There's a bunch of statistics-related methods in the JobQueue class that allow to find out the current size of the queue, number of executed, deduplicated or abandoned jobs. These methods are used in some API calls and maintenance scripts and some wiki administrators actually use that statistics. Although it's not critically important, it would be nice to implement that functionality in the JobQueueEventBus as well.
The complication though is that we don't know the queue size in mediawiki - only Kafka kinda know the size of the queue. So there're several options:
- Use redis to update some counters on pushing and popping. This sounds like a terrible solution from all perspectives.
- Make EventBus service expose some endpoint with queue status. It will get the information by getting the metadata from the Kafka client and shuffling it to an appropriate format. The downside of this solution is that Event-Platform service needs to know which consumer groups ChangeProp uses. It's possible to make it know that, but it's a fairly ugly solution.
- Make ChangeProp expose the same endpoint. The downside is that right now MediaWiki doesn't directly talk to changeprop and adding this dependency is not really desirable.
- Drop the statistics functionality all together
- Graph queue size in graphite or prometheus, and retrieve current value from the graphite / prometheus API.
- Other?
How do you think we should proceed?