使用 Pubsub 和 Slack 的 GCP 计费警报 -​​ 我每 30 分钟收到一条消息

GCP Billing Alert with Pubsub and Slack - I get a message every 30 minutes

我设置了一个发布到 Pub Sub 的账单提醒,我有一个云功能可以订阅消息并将消息发送到 Slack 上的频道。它运作良好,但即使未达到预算中的阈值,我也会每隔 30 分钟在 Slack 上收到一条消息。可能是什么原因造成的?

请注意,如 documentation budget notifications are sent to the Pub/Sub topic multiple times per day with the current status of your budget. I suppose that your Cloud Functions triggers each time one of these notifications is sent and therefore the behavior you are experiencing. Add some logic on your Cloud Function in order to only send the message to the Slack channel only if certain condition is met as according to the data received from the Pub/Sub topic or consider using other Budget monitoring strategies, such as alert email notifications 所述,只有达到特定阈值,您才能收到相关电子邮件。