'Google PubSub - Counting how many messages in Subscription

I've looked over the documentation for Google's PubSub, and also tried looking in Google Cloud Monitoring, but couldn't find any means of figuring out how to get the total amount of messages in my subscriptions.

Since I plan on using PubSub to analyze the amount of data that comes in, it's important for me to get a total count of messages in each subscription.

I would love to know if this is a supported feature or if there is a metric that can calculate the amount.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source