-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: blueprint for errorLogs function (#18)
* feat: blueprint for errorLogs function * Apply suggestions from code review --------- Co-authored-by: Will Russell <[email protected]>
- Loading branch information
1 parent
9560ccd
commit 26580a9
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
id: error-logs | ||
namespace: company.team | ||
|
||
tasks: | ||
- id: fail | ||
type: io.kestra.plugin.core.execution.Fail | ||
errorMessage: Something went wrong, make sure to fix it asap! | ||
|
||
errors: | ||
- id: slack | ||
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook | ||
url: "{{ secret('SLACK_WEBHOOK') }}" | ||
payload: | | ||
{ | ||
"text": "Failure alert for flow `{{ flow.namespace }}.{{ flow.id }}` with ID `{{ execution.id }}`. Here is a bit more context about why the execution failed: `{{ errorLogs()[0]['message'] }}`" | ||
} | ||
extend: | ||
title: Using errorLogs function to send error message to Slack | ||
description: >- | ||
This `fail` task of the workflow will always fail. | ||
The error logs are captured using the `errorLogs()` function which is sent | ||
as a Slack alert message. | ||
The `errorLogs()` function retrieves a list of error logs from the failed task run. | ||
This is useful when sending alerts on failure. When using this function e.g. in a | ||
Slack alert message, you'll have the context about why the execution failed. | ||
tags: | ||
- Error | ||
- Fail | ||
ee: false | ||
demo: false | ||
meta_description: This workflow uses errorLogs function to retrive list of error logs. |