List execution counts for a list of flows.

This can be used to send an alert if a condition is met about execution counts.

yaml
type: "io.kestra.plugin.core.execution.Count"

Send a slack notification if there is no execution for a flow in the last 24 hours.

yaml
id: executions_count
namespace: company.team

tasks:
  - id: counts
    type: io.kestra.plugin.core.execution.Count
    expression: "{{ count == 0 }}"
    flows:
      - namespace: company.team
        flowId: logs
    startDate: "{{ now() | dateAdd(-1, 'DAYS') }}"

  - id: for_each
    type: io.kestra.plugin.core.flow.ForEach
    concurrencyLimit: 0
    values: "{{ jq outputs.counts.results '. | select(. != null) | .[]' }}"
    tasks:
      - id: slack_incoming_webhook
        type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
        payload: |
          {
            "channel": "#run-channel",
            "text": ":warning: Flow `{{ jq taskrun.value '.namespace' true }}`.`{{ jq taskrun.value '.flowId' true }}` has no execution for last 24h!"
          }
        url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"

triggers:
  - id: schedule
    type: io.kestra.plugin.core.trigger.Schedule
    backfill: {}
    cron: "0 4 * * * "
Properties

The expression to check against each flow

The expression is such that the expression must return true in order to keep the current line. Some examples:

  • yaml {{ eq count 0 }} : no execution found
  • yaml {{ gte count 5 }} : more than 5 executions

The start date

The end date

SubType

A list of flows to be filtered

If not provided, namespaces must be set.

SubType string
SubType string
Possible Values
CREATEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINT

A list of states to be filtered

SubType