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

Viewed 728

I set up a billing alert that publishes to Pub Sub and I have a cloud function that subscribes and sends a message to a channel on Slack. It works good but I keep getting a message on Slack about every 30 mins even though the threshold in the budget is not reached. What might be causing this?

1 Answers

Notice that as stated on the 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 where you could receive the relevant emails only if a certain threshold is met.

Related