Blueprints

Send an alert to Sentry when a flow fails

Source

yaml
id: sentry-alert
namespace: company.team

tasks:
  - id: fail
    type: io.kestra.plugin.core.execution.Fail

errors:
  - id: alert_on_failure
    type: io.kestra.plugin.notifications.sentry.SentryAlert
    dsn: "{{ secret('SENTRY_DSN') }}"
    payload: >
      {
          "timestamp": "{{ execution.startDate }}",
          "platform": "java",
          "level": "error",
          "transaction": "/execution/id/{{ execution.id }}",
          "server_name": "localhost:8080",
          "extra": {
            "Namespace": "{{ flow.namespace }}",
            "Flow ID": "{{ flow.id }}",
            "Execution ID": "{{ execution.id }}",
            "Link": "http://localhost:8080/ui/executions/{{flow.namespace}}/{{flow.id}}/{{execution.id}}"
          }      
      }

About this blueprint

Notifications

This flow shows how to send an alert to Sentry when a flow fails. The only required input is a DSN string value, which you can find when you go to your Sentry project settings and go to the section "Client Keys (DSN)". You can find more detailed description of how to find your DSN in the following Sentry documentation. You can customize the alert payload, which is a JSON object, or you can skip it and use the default payload created by kestra. For more information about the payload, check the Sentry Event Payloads documentation. The event_id is an optional payload attribute that you can use to override the default event ID. If you don't specify it (recommended), kestra will generate a random UUID. You can use this attribute to group events together, but note that this must be a UUID type. For more information, check the Sentry documentation.

Fail

Sentry Alert

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra