Repository navigation
Pubsub feature: get messages count waiting in subscription #527
Description
Activity
FYI: as https://code.google.com/p/cloud-pubsub/issues/detail?id=13 told me, there is a "num_undelivered_messages" endpoint to get that metric.
Considering it's "not accurate" I wouldn't use it yet and don't think we should support it in this library until we know it is accurate.
- addedapi: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.
on May 5, 2015 This feature could never be accurate because messages are always flowing into the subscription (depending on the publish rate), but it's crucial to know if you need to add more workers to process messages or monitor the health of your workers.
From https://cloud.google.com/monitoring/api/metrics, they list two interesting ones:
num_outstanding_messages: Current number of messages delivered but not yet acknowledged.
num_undelivered_messages: Current number of messages pending to be delivered.Maybe we could open up a generic
subscription.getMetrics('num_outstanding_msesages')and anything else from the list:topic.getMetrics('message_sizes'), as these may all be useful.Reacted by Robert Christian, Eric Ekong and Kosmas PapadatosAssigned this to @callmehiphop since you had some ideas for how to implement this generically.
what about this one?
We have a few more things to implement with a higher priority before getting to this one, mostly support for the Prediction and Translate APIs, then promises.
@stephenplusplus if i will create a pull request, you will merge?
That would be great!
- addedpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.
on Mar 7, 2017 Great to see you guys working on this already. If its worth, right now I use stackdriver's subscription metrics capabilities to get this information, apparently, stackdriver lags behind and the count is not accurate. Just wanted to add +1 to this request and happy to be a beta tester, if need be. Let me know.
Reacted by Robert Christian25 remaining items
- added a commit that references this issue
on Jan 28, 2026 - added a commit that references this issue
on Feb 5, 2026 - added a commit that references this issue
on Feb 17, 2026 - added a commit that references this issue
on Feb 24, 2026 - added 2 commits that reference this issue
on Mar 11, 2026 - added a commit that references this issue
on Mar 27, 2026 - added a commit that references this issue
on May 5, 2026
Hi,
I need to know how many messages are waiting in the subscription, to pop new workers or monitor the health of my system. This is something AWS SQS does too.
Is it in the roadmap actually ?
Thank you