PubSub metrics delay

I want to scale my app based on PubSub metrics, I’m able to fetch the metrics and scale successfully.
But… there is a big delay until the metrics are available.
Is there any way to achieve the metrics more quickly?

From my understanding, this is how most metrics work.

subscription/num_undelivered_messages
Number of unacknowledged messages (a.k.a. backlog messages) in a subscription.
Sampled every 60 seconds. After sampling, data is not visible for up to 120 seconds. 
Solved Solved
0 8 1,018
1 ACCEPTED SOLUTION

 

You can also fill out a feature request to ask for a reduction of this time, although there’s no ETA.

It is recommended that you first look for a similar feature request because we wait for a feature to have a handful of stars and, hopefully, comments from several users about how the feature would be useful.

So, when it comes to feature requests, it’s especially important to vote for an existing request (if one exists) instead of making a duplicate. If you consider opening a new feature request, this form will be useful.

View solution in original post

8 REPLIES 8

As mentioned here in the blue note section, Backlog metrics might have gaps in values for up to several minutes. Take a look at Monitor delivery latency health . If your message backlog is increasing, you can use the Delivery latency health score to check which factors are contributing to an increased latency.

rephrasing: there is a big delay until the metrics are available in GCP monitoring.
Is there any way to achieve the metrics more quickly?

Please share what metrics you are using.

As I wrote in the original post

subscription/num_undelivered_messages

The time varies according to the monitored resource and other factors. Because of the variable you are using, it should take up to 120 seconds to be available, but if it’s longer, it is highly recommended to contact Google Cloud Support to inspect and analyze your Cloud project and, if necessary, fix the related issue.

it takes up to 120 seconds, which is too long…

I already reached to the GCP support and they can’t fix that.

Thanks

 

You can also fill out a feature request to ask for a reduction of this time, although there’s no ETA.

It is recommended that you first look for a similar feature request because we wait for a feature to have a handful of stars and, hopefully, comments from several users about how the feature would be useful.

So, when it comes to feature requests, it’s especially important to vote for an existing request (if one exists) instead of making a duplicate. If you consider opening a new feature request, this form will be useful.

to confirm, this delay exists when using HPA and not just querying the metrics api?

https://cloud.google.com/kubernetes-engine/docs/tutorials/autoscaling-metrics#pubsub