Hi Team, For this issue i am attaching documentation for your reference how to create a alert policy on gcp console.It will really help for all GCP folks.
Creating Alert policy Metric for Cloud DataProc Job Failure on Test and Prod Environment:
• First Step we need to go “google cloud console” and choose Flexible environment.
• Go to Cloud logging page view the error logs. According to the Error logs we need to create metric.
• Here we need to select the cluster name, service name and Error message. For your reference I am attaching the snapshot below.

• In the above snapshot there will the create metric option. We need to select that metric option once after selecting the metric option it will show like below snapshot.
• After selecting Create Metric , It will shows the Details, Filter selection& We can add Labels as well.
Note: This custom metric we are creating according to our error Logs. Here We need to fill mandatory fields like log based name, description and Filter Selection. Once after filling the details. Click on create a cluster.
Important: According to your filter section you can check the logs. There is preview logs option on top Filter selection. This preview log will show only one hour duration logs. That means, If suppose your job failure on 10:30 am it will show upto 11:30 am. After that it won’t show any logs.
Note:
If you want to create a custom metric I will suggest to check the job failure time and create the custom metric. If we create at that time you can apply regular expression as well and you can pick which label you want from this error logs.
• After Creating the custom metric we need to navigate into Metric Explorer page.
• Here We need to select our created metric name form metric drop options. Once after selecting our metric name, we can choose which graph is suitable for you to create a threshold value.
• After selecting this value, it will show the error logs according to your custom filters.
Note: for your reference here, I am selecting my custom metric in that custom metric I am applying the filter on dataproc cluster job failure name and click on apply button.
• After Selecting according to cluster name it will show cluster job failure log on the graph.Upto here we are just creating the metric.
• Now, We need to select the aletring option from navigation menu on left side of the console.
• After selecting the Alerting option it will show like below snap shot.
• Click on Create policy option. Will take into the alert policy creation page and select your custom metric name and click on apply button on it.
• After selecting your metric it will show the error graph according to the cluster name from above snapshot and Click Next Button it will take into Alter Details.
• Here We need to give threshold value according to our job failure and click on next button.
• Here We need to fill the notification channel with your email id or your team mail group name. and we need to mention subject for the alert notification. According to your severity you need to select the policy Severity level and Give unique name for your Alert policy.
• Once after creation the alert policy you will receive alert notifications according to your severity.
• This is to create custom alert metric and policy.