Hello,
Having following in Metrics explorer:
I need using Java client to get a current amount of undelivered_messages in the specific subscription_id. It's not clear how to do this.
Found following article:
https://cloud.google.com/monitoring/custom-metrics/reading-metrics
ListTimeSeriesRequest.Builder requestBuilder =
ListTimeSeriesRequest.newBuilder()
.setName(name.toString())
.setFilter(
"metric.type=\"pubsub.googleapis.com/subscription/num_undelivered_messages\" AND metric.label.subscription_id = \"myexporter\"")
.setInterval(interval)
.setView(ListTimeSeriesRequest.TimeSeriesView.HEADERS);
But it's not clear:
- how to filter data by subscription_id
- how to get not TimeSeries data, but current value