2 回答
TA贡献1829条经验 获得超4个赞
这对我有用,但我不确定这是否是创作者的意图。
from google.cloud import monitoring_v3
from google.cloud.monitoring_v3 import query
project = "..."
client = monitoring_v3.MetricServiceClient()
result = query.Query(
client,
project,
'pubsub.googleapis.com/subscription/num_undelivered_messages',
minutes=1).as_dataframe()
TA贡献1805条经验 获得超9个赞
对于特定订阅,您可能需要以这种方式运行代码:
from google.cloud import monitoring_v3
from google.cloud.monitoring_v3 import query
project = "my-project"
client = monitoring_v3.MetricServiceClient()
result = query.Query(client,project,'pubsub.googleapis.com/subscription/num_undelivered_messages', minutes=60).as_dataframe()
print(result['pubsub_subscription'][project]['subscription_name'][0])
添加回答
举报