David Anderson
10/16/2023, 6:54 PM{
"match": {
"prefect.resource.id": "prefect.flow-run.*"
},
"match_related": {
"prefect.resource.id": "prefect.deployment.70cb25fe-e33d-4f96-b1bc-74aa4e50b761",
"prefect.resource.role": "deployment"
},
"for_each": [
"prefect.resource.id"
],
"after": [],
"expect": [
"prefect.flow-run.Failed"
],
"posture": "Reactive",
"threshold": 2,
"within": 10
}
Jeff Hale
10/16/2023, 7:04 PMDavid Anderson
10/16/2023, 10:12 PMresource
part of the webhook event. i can then use those elements as filters in the match
part of the automation trigger setup.
probably other ways to accomplish the same end result, but ive got this working for me as desired. πͺJohn Kang
12/15/2023, 4:58 PMresource
part of the webhook event as a filter in the match
part of the automation trigger? I am not sure how to do that. I've tried labeling the item as resource.custom-element
but that is not working.Jeff Hale
12/15/2023, 5:06 PM{
"match": {
"prefect.resource.id": "gh-repo-discdiver.41"
},
You can use an asterisk to match on all the first part of the ids.
e.g.
{
"match": {
"prefect.resource.id": "gh-repo-discdiver.*"
},
Does that get you what you need?John Kang
12/15/2023, 5:08 PMprefect.resource.database
which I defined in the webhook:
{
"match": {
"prefect.resource.id": "webhook.resource.id"
},
"match_related": {
"prefect.resource.name": "ovt_completion",
"prefect.resource.database": "OVT PRODUCTION"
},
"after": [],
"expect": [
"webhook.called"
],
"for_each": [],
"posture": "Reactive",
"threshold": 1,
"within": 0
}
webhook results:
{
"id": "868de4b3-f032-46fd-9c56-e5e051f6c984",
"account": "f2264e8b-bee1-4943-89e5-2480677670cf",
"event": "webhook.called",
"occurred": "2023-12-15T17:04:15.057Z",
"payload": {
"method": "POST",
"headers": {
"host": "api.prefect.cloud",
"user-agent": "python-requests/2.31.0",
"accept-encoding": "gzip, deflate",
"accept": "*/*",
"content-length": "14",
"x-request-id": "f5ebdd45-2095-94d2-a790-47fce49933db"
},
"body": "OVT PRODUCTION",
"raw_body": "OVT PRODUCTION"
},
"received": "2023-12-15T17:04:15.059Z",
"related": [
{
"prefect.resource.id": "prefect-cloud.webhook.1adf3e46-ff33-4405-b715-de0a8c1f5e24",
"prefect.resource.name": "ovt_completion",
"prefect.resource.role": "webhook"
}
],
"resource": {
"prefect.resource.id": "webhook.resource.id",
"producing": "OVT CADS",
"prefect.resource.database": "OVT PRODUCTION"
},
"workspace": "140a070a-5c2c-4de9-9bf6-33d62e675a65"
}
John Kang
12/15/2023, 5:09 PMJohn Kang
12/15/2023, 5:09 PMprefect.resource.id
and use that instead of generating a new element?John Kang
12/15/2023, 5:13 PMJohn Kang
12/15/2023, 5:14 PMJohn Kang
12/15/2023, 5:15 PMJeff Hale
12/15/2023, 5:41 PMmatch_related
is for matching related Prefect events.
I would expect that expect
has the ability to be used to differentiate the two cases. Is something missing there?
cc: @Will RaphaelsonJohn Kang
12/15/2023, 5:54 PM{
"match": {
"prefect.resource.id": "webhook.resource.id"
},
"match_related": {
"prefect.resource.name": "ovt_completion"
},
"after": [],
"expect": [
"webhook.called",
"ODIN PROD*"
],
"for_each": [],
"posture": "Reactive",
"threshold": 1,
"within": 0
}
John Kang
12/15/2023, 6:22 PMJeff Hale
12/15/2023, 11:35 PMWill Raphaelson
12/18/2023, 3:56 PM