subscription/num_outstanding_messages
메트릭 (google-cloud-python에서 https://cloud.google.com/monitoring/api/metrics#gcp-pubsub)에 액세스 할 수 있습니까? 비슷한 코드를 사용하여 num_undelivered_messages
미터법에 성공적으로 액세스했지만 다음 쿼리의 결과를 반복하면 (항상 성공 함) 항상 빈 목록이 생성됩니다.Python에서 Google PubSub의 구독/num_oustanding_messages 통계에 액세스
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import monitoring
>>> client = monitoring.Client()
>>> q = client.query(
... "pubsub.googleapis.com/subscription/num_undelivered_messages",
... minutes=90
...)
>>> len(list(q)) > 0
True
>>> q = client.query(
... "pubsub.googleapis.com/subscription/num_outstanding_messages",
... minutes=90
...)
>>> len(list(q)) > 0
False
관련 구글 클라우드 - 파이썬 라이브러리 버전 :
~:pip freeze | grep google
gapic-google-logging-v2==0.10.1
gapic-google-pubsub-v1==0.10.1
google-cloud==0.21.0
google-cloud-bigquery==0.21.0
google-cloud-bigtable==0.21.0
google-cloud-core==0.21.0
google-cloud-datastore==0.21.0
google-cloud-dns==0.21.0
google-cloud-error-reporting==0.21.0
google-cloud-happybase==0.20.0
google-cloud-language==0.21.0
google-cloud-logging==0.21.0
google-cloud-monitoring==0.21.0
google-cloud-pubsub==0.21.0
google-cloud-resource-manager==0.21.0
google-cloud-runtimeconfig==0.21.0
google-cloud-storage==0.21.0
google-cloud-translate==0.21.0
google-cloud-vision==0.21.0
google-gax==0.14.1
googleapis-common-protos==1.5.0
grpc-google-iam-v1==0.10.1
grpc-google-logging-v2==0.10.1
grpc-google-pubsub-v1==0.10.1