I would like to know if it’s possible to log operations from my Cloud Functions to Cloud Monitoring, and then create alert policies based on those logs to send email notifications to stakeholders. Additionally, is it possible to create custom metrics from these logs for more detailed monitoring?
Example: I am creating cloud functions to archive data, I want to create a log entry that mentions whether archival was successful or not. Then, cloud monitoring would send notification based on that status. Is this feasible ?
Yes, it’s possible to create a notification pipeline from Cloud Functions operations based on log metrics on Cloud Monitoring. These metrics define alerting policies that notify stakeholders via email or other supported channels.
To set up the notification pipeline, you can follow this Google Cloud blog post which outlines how to route alerts from Cloud Monitoring. Although the post references Cloud Run, this approach applies to Cloud Functions as well, since they are built on the same underlying infrastructure—see Cloud Functions on Cloud Run for more details.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.