Yufei Li
02/07/2025, 3:08 PMmatch_related = {
"prefect.resource.role": "log", #,
"prefect.log.error": [ "*The object is not found*"]
},
Marvin
02/07/2025, 3:08 PMmatch
and match_related
fields to filter events. Here are some key points:
1. Filter Configuration: The match_related
field allows you to filter events based on related resources. Each label in a filter is combined with others using an AND operation, and lists of values are OR'ed together.
2. Custom Triggers: You can define custom triggers that respond to specific log messages. However, your current configuration seems to be incorrect or insufficient for your needs.
3. Log Filtering: Prefect's documentation suggests that you can filter events using fields like prefect.resource.role
and prefect.log.error
, but the exact implementation details for log-based triggers are not explicitly documented. You might need to ensure that the log events you want to trigger on are being emitted correctly and are accessible in the context where the automation is evaluated.
For more detailed guidance, you might want to review these sections in the Prefect documentation:
- Custom Triggers
- Automations and Triggers
Given that your current configuration isn't working, you may need to verify the structure and content of the emitted logs to ensure they match the filter criteria. If the issue persists, consider reaching out to the Prefect community or support for more tailored assistance.Yufei Li
02/07/2025, 3:12 PMMarvin
02/07/2025, 3:12 PMprefect.resource.role
in the match_related
conditions. The documentation primarily focuses on role-based access controls (RBAC) for user permissions in Prefect Cloud, which is not directly related to event triggers or logs.
To determine if "log" can be used as a prefect.resource.role
, you might need to experiment within your Prefect environment or consult with the Prefect community or support. The existing documentation does not explicitly cover this use case in detail.Kevin Grismore
02/07/2025, 3:24 PMfrom prefect import flow, emit_event
@flow
def my_erroring_function():
try:
... # thing that could fail
except SomeError as e:
emit_event(event="Object Not Found", resource={"prefect.resource.id": "prefect.log.notfounderror"}
Then your automation trigger could just
"match": {
"prefect.resource.id": [
"prefect.log.notfounderror"
]
},
Yufei Li
02/07/2025, 3:33 PM"Job reached backoff limit."
. Can I use the same approach?Kevin Grismore
02/07/2025, 7:44 PMYufei Li
02/07/2025, 7:46 PMYufei Li
02/07/2025, 7:53 PMJob reached backoff limit
as an indicator for this