I have been using this example of creating a Vertex AI monitoring job. It sends an email.
alerting_config = vertex_ai_beta.ModelMonitoringAlertConfig(
email_alert_config=vertex_ai_beta.ModelMonitoringAlertConfig.EmailAlertConfig(
user_emails=NOTIFY_EMAILS
)
Is there any way to instead send a Pubsub message?
You can configure the alert to be sent to Cloud Logging. To enable Cloud Logging alerts you have to set the enableLogging
field on your ModelMonitoringAlertConfig
configuration to TRUE
. Then you can forward the logs to any service that Cloud Logging supports, Pub/Sub is one of these.
For this you’ll need one of the following permissions:
Then you need to create a sink.
After that you have created the sink you’ll need to set the destination permissions.
While Cloud Logging provides you with the ability to exclude logs from being ingested, you might want to consider keeping logs that help with supportability. Using these logs can help you quickly troubleshoot and identify issues with your applications.
Logs routed to Pub/Sub are generally available within seconds, with 99% of logs available in less than 60 seconds.