Closed CGenie closed 2 weeks ago
This is a good idea and I think the implementation would be fairly straight forward.
We'd need to add the queue_availalbe_length
or queue_length_visible
to pgmq.metrics_result type.
Then add something like count(*) where vt <= now()
someplace in pgmq.metrics()
Done in #332, will be released in 1.5.0. Thank you for creating the issue
The
pgmq.metrics
function returns, in particular, thequeue_length
column (https://tembo-io.github.io/pgmq/api/sql/functions/#metrics) which is the total number of messages.However, when all my messages have vt set sometime in the future, even though
queue_length > 0
I might not get any message when I issuepgmq.read
(c.f. https://tembo-io.github.io/pgmq/api/sql/functions/#set_vt). My suggestion is to also add something likequeue_available_length
which returns the number of messages that are readily available.