【问题标题】:REST API for monitoring undelivered message in google cloud pubsub用于监控谷歌云 pubsub 中未传递消息的 REST API
【发布时间】:2019-03-09 08:06:29
【问题描述】:

我想实现一项服务来监控未传递的消息并在达到阈值或进一步处理时发送通知。

我已经浏览过 Stackdriver。它为我提供了监控和警报,它仅提供获取 metricDescriptor 的 API,但不提供获取未传递消息的 API,如您在 Stackdriver Monitoring API 中所见。

实际上是否有提供 API 来获取指标值?

【问题讨论】:

    标签: google-cloud-platform google-cloud-pubsub stackdriver google-cloud-stackdriver


    【解决方案1】:

    您可以通过projects.timeSeries.list method 获取值。您可以将名称设置为projects/<your project>,将过滤器设置为metric.type = "pubsub.googleapis.com/subscription/num_undelivered_messages",并将结束时间(如果需要一系列值,还包括开始时间)设置为一个字符串,该字符串以 RFC3339 UTC "Zulu" 格式表示时间,例如,2018-10-04T14:00:00Z。如果您想查看特定订阅,请将过滤器设置为 metric.type = "pubsub.googleapis.com/subscription/num_undelivered_messages" AND resource.label.subscription_id = "<subscription name>"

    结果将是一个或多个 TimeSeries 类型(取决于您是否指定了特定订阅),其中 points 字段包括指定时间范围内的数据点,每个都将具有 @987654328 @'s int64Value 设置为尚未被订阅者确认的消息数。

    【讨论】:

    • 我很难找到这个。真的谢谢你的回答。这对我很有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-15
    • 1970-01-01
    相关资源
    最近更新 更多