【问题标题】:difference between topic/send_message_operation_count and topic/send_request_count in google pubsubgoogle pubsub 中的 topic/send_message_operation_count 和 topic/send_request_count 之间的区别
【发布时间】:2018-04-06 17:57:12
【问题描述】:
google pubsub 中的 topic/send_message_operation_count 和 topic/send_request_count 有什么区别。
要求是虽然我可以通过 undeliver_messages 计算订阅者中存在的消息数量,但我需要计算推送到主题的消息数量。
谢谢,
桑托什
【问题讨论】:
标签:
google-cloud-pubsub
stackdriver
google-cloud-stackdriver
【解决方案1】:
topic/send_message_operation_count 的文档说:
发布消息操作的累积计数,按结果分组。
topic/send_request_count 的文档说:
发布请求的累积计数,按结果分组。
Pub/Sub 允许在单个 API 请求中批量处理多条消息。 send_request_count 是发布 API 调用的数量,而 send_message_operation_count 是这些调用中实际消息的数量。
因此,如果平均每个请求发送 10 条消息,send_message_operation_count 将是 send_request_count 的 10 倍。如果您在每个 API 调用中发布一条消息,它们将是相同的。