Alexis Chicoine
08/31/2023, 12:47 AM{
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"match_related": {
"prefect.resource.id": "prefect.deployment.8517b52a-165b-4afa-8a31-491d47b3cc50",
"prefect.resource.role": "deployment"
},
"after": [
"prefect.flow-run.Completed", "prefect.flow-run.Cancelled", "perefect.flow-run.Crashed", "prefect.flow-run.Failed"
],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": ["related:deployment:prefect.resource.id"],
"posture": "Proactive",
"threshold": 1,
"within": 300
}
I started without the after and with the for_each as the default prefect.resource.id, but it seemed to trigger more than I was expecting (more than once per period of time set in within). Not sure what the behaviour is supposed to be for a proactive with no after. When does a new window for the within get created? The after here is attempting to set the window for the within to start when a run enters a terminal state.
I’m trying to set the trigger to look at runs in the related deployment, but I don’t think the way I wrote it is correct.
So far what I got is that match is the event type that the trigger will look for. Match_related is a way to filter the events like the in this case a specific deployment. for_each I still don’t have a good understanding of it.
I’d like to fix this use case, but also if you have some examples where for_each is used with different values or a good explanation of how it works that would be appreciated.Will Raphaelson
08/31/2023, 4:23 PM"for_each": [
"prefect.resource.id"
],
{
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"match_related": {
"prefect.resource.id": "prefect.deployment.8517b52a-165b-4afa-8a31-491d47b3cc50",
"prefect.resource.role": "deployment"
},
"after": [],
"expect": [
"prefect.flow-run.Completed"
],
"for_each": [
"prefect.resource.id"
],
"posture": "Proactive",
"threshold": 1,
"within": 300
}
Alexis Chicoine
08/31/2023, 5:23 PMWill Raphaelson
08/31/2023, 5:24 PMAlexis Chicoine
08/31/2023, 5:30 PMWill Raphaelson
08/31/2023, 7:16 PMAlexis Chicoine
08/31/2023, 8:10 PMWill Raphaelson
08/31/2023, 9:21 PMAlexis Chicoine
08/31/2023, 9:37 PMWill Raphaelson
08/31/2023, 9:40 PM"for_each": ["related:deployment:prefect.resource.id"]
I think you should remove the match on deployment_id, cause thats already filtering down the trigger criteria to only that deployment.Alexis Chicoine
08/31/2023, 9:44 PMWill Raphaelson
08/31/2023, 9:45 PMAlexis Chicoine
08/31/2023, 9:47 PMWill Raphaelson
08/31/2023, 9:50 PM