I have a Azure Data factory pipeline in which have a activity that runs a sql script. I have retry setup on Activity for it to run again after its fails on first run. I want to send an email when it fails on its first run and is retrying.
I have tried to set up a failure output from activity to send a mail. But it will retry without sending the mail (through web activity).
I want to send email once it fails in its first run and is retrying on second run.
CodePudding user response:
You can create an Alert
in Azure Data Factory (ADF) Monitor
section under Alerts and Metrics
option.
- Go to
Monitor
section on ADF Studio and click onAlerts and Metrics
thenNew alert rule
as shown below.
- Give a alert rule name to new alert rule. Provide a description about the rule. Give a Severity for this alert and then click on
Add criteria
for this alert.
- From the given list, choose the
Failed activity runs metrics
criteria and click on Continue. This will create a criteria for the failed activity based on yourConfiguration alert logic
in next step. Under configuration you can mention the count for how each time the activity fails you will get the alert.
Now click on
Configure Notification
option in step 2 image.Give an
action name
. UnderSelect which notification you'd like to receive
check mark Email and give the email address on which you want to give alert. Click onAdd notification
.
Now you will get notification every time the activity fail.
Note: The retry you should mention in the activity level to run it required number of times after failure. You will get the failure alert for each time the activity re-run and fail.
To know more check official document Data Factory metrics and alerts.