Blueprints

Set up alerts for failed workflow executions using Sentry

About this blueprint

Notifications System

This system flow will help you set up alerts for failed workflow executions. Using this pattern, you can manage alerts on failure in one place.

This flow sends an alert to Sentry whenever a flow execution fails.

Setup

To configure the alert, you need to get the DSN string value. Navigate to your Sentry project settings and go to the section "Client Keys (DSN)".

Copy the DSN string value and store it as a secret in Kestra.

Customization

You can further cus tomize that system flow by modifying the SentryExecution task, or by adding more tasks to the flow.

You can customize the alert payload, which is a JSON object.

The level parameter is the severity of the issue. The task documentation lists all available options including DEBUG, INFO, WARNING, ERROR, FATAL. The default value is ERROR.

Restricting alerts using conditions

You can restrict the flow to only send alerts for specific namespaces by adding an ExecutionNamespaceCondition to the trigger. You can read more about that in the Administrator Guide.

yaml
id: failure_alert_sentry
namespace: system

tasks:
  - id: send_alert
    type: io.kestra.plugin.notifications.sentry.SentryExecution
    executionId: "{{ trigger.executionId }}"
    transaction: "/execution/id/{{ trigger.executionId }}"
    dsn: "{{ secret('SENTRY_DSN') }}"
    level: ERROR

triggers:
  - id: on_failure
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - type: io.kestra.plugin.core.condition.ExecutionStatusCondition
        in:
          - FAILED
          - WARNING

Sentry Execution

Flow

Execution Status Condition

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra