Google cloud pubsub 如何从Stackdriver外部的pubsub检索指标

Google cloud pubsub 如何从Stackdriver外部的pubsub检索指标,google-cloud-pubsub,Google Cloud Pubsub,我想知道如何从API中检索度量。(我看到了这个话题,但不是同一个问题) 当我试图从日志API检索它们时,它返回404错误 这是不可能的,或者只是缺少权利 客户端错误:`GEThttps://logging.googleapis.com/v2/projects/my-project/metrics/pubsub.googleapis.com/topic/send_message_operation_count`导致找不到'404'` 谢谢你的时间 和是不同的。发布/订阅中的指标作为Stackdr

我想知道如何从API中检索度量。(我看到了这个话题,但不是同一个问题)

当我试图从日志API检索它们时,它返回404错误

这是不可能的,或者只是缺少权利

客户端错误:`GEThttps://logging.googleapis.com/v2/projects/my-project/metrics/pubsub.googleapis.com/topic/send_message_operation_count`导致找不到'404'`

谢谢你的时间

和是不同的。发布/订阅中的指标作为Stackdriver监控的一部分进行收集。logging.googleapis.com API是Stackdriver日志的一部分,用于搜索、分析和监视日志

要访问
send\u message\u operation\u count
度量,您需要使用该方法。您可以将
filter
设置为
metric.type=“pubsub.googleapis.com/topic/send_message\u operation\u count”
,将
interval.startTime
设置为需要数据的时间间隔的开始,例如
2017-02-24T21:01:23.00Z
,并将
interval.endTime
设置为需要数据的时间间隔的结束,例如,
2017-02-24T22:01:23.00Z
。您还可以设置其他属性来更改返回的数据和方式。如果要返回特定主题的数据,请将
和resource.label.topic\u id=”“
添加到筛选器中

完整的请求URL(没有必要的授权信息)看起来像:

https://monitoring.googleapis.com/v3/projects/my-project/timeSeries?interval.endTime=2017-02-24T22%3A01%3A23.00Z&filter=metric.type%20%3D%20%22pubsub.googleapis.com%2Topic%2Send\u message\u operation\u count%22%20和%20resource.label.topic\u id%20%3D%20%22my topic%22&interval.startTime=2017-02-23T21%3A01%3A23.00Z