New to Kestra?
Use blueprints to kickstart your first workflows.
Audit Apache Druid sys.tasks for ingestion failures and stalled task durations. Evaluate operational SLA gates and trigger Slack alerts.
Apache Druid relies on distributed ingestion tasks running on MiddleManager workers or indexing peons to consume high-throughput streaming events from Kafka or Kinesis, as well as to execute scheduled compaction and batch loads. When data schema drift occurs, network partitions disrupt stream ingestion, or worker slots experience memory pressure, ingestion tasks can fail repeatedly or stall in a running state indefinitely, exhausting MiddleManager execution slots and stalling downstream analytical dashboards.
This blueprint provides an automated Day 2 operations sentinel for Apache Druid. It inspects Druid's native sys.tasks and sys.servers system catalog views over Avatica JDBC, evaluates aggregate failure counts and stalled task execution durations against operational SLA thresholds, and dispatches structured Slack notifications when ingestion health degrades.
periodic_sentinel_schedule triggers the sentinel workflow on a 30-minute cron schedule (disabled by default so connection endpoints and thresholds can be configured).probe_ingestion_tasks executes an aggregating SQL query against sys.tasks via io.kestra.plugin.jdbc.druid.Query with fetchType: FETCH_ONE. It quantifies total tasks, failed tasks within the rolling lookback window, and active tasks exceeding max_task_duration_ms.probe_failed_task_offenders queries sys.tasks with fetchType: FETCH to extract detailed context (task ID, datasource, task type, duration, and error preview) for up to 5 offending tasks.probe_worker_cluster_capacity queries sys.servers to verify the count of healthy MiddleManager and Historical worker nodes currently registered in the cluster.evaluate_ingestion_health uses io.kestra.plugin.core.flow.If to check if failed_task_count meets or exceeds max_allowed_failed_tasks, or if stalled_task_count meets or exceeds max_allowed_stalled_tasks.evaluate_alert_mode checks alert_mode: ALERT posts a formatted Slack notification via io.kestra.plugin.slack.notifications.SlackIncomingWebhook, while AUDIT_ONLY logs the violation without paging on-call staff.log_healthy_status records a healthy audit entry.log_sentinel_audit_complete runs at the conclusion of every execution to maintain an unbroken audit trail of sentinel passes.errors handler catches connection errors or unreachable endpoints and alerts operators that the monitoring sentinel is offline.status = 'FAILED') and runaway resource starvation (status = 'RUNNING' past time ceiling).AUDIT_ONLY mode to benchmark baseline task turnover before enabling live paging channels.Druid's built-in coordinator and overlord web consoles display task states interactively but do not provide autonomous alerting or conditional incident triage workflows. Kestra delivers declarative, version-controlled workflow orchestration with built-in secret masking, conditional branching, native Slack integrations, and full execution history tracking. Managing the sentinel as a Kestra blueprint replaces brittle custom cron scripts with a resilient, observable automation pipeline.
sys.tasks, sys.servers).DRUID_USERNAME: Database user for authenticating against Druid Avatica SQL endpoint.DRUID_PASSWORD: Database password for authenticating against Druid Avatica SQL endpoint.SLACK_WEBHOOK: Incoming webhook URL for the target Slack channel (required for live alerting).Note for Kestra Open-Source (OSS): Secrets are configured as base64-encoded environment variables formatted as
SECRET_<NAME>(e.g.SECRET_DRUID_USERNAME,SECRET_SLACK_WEBHOOK).
| Name | Type | Default | Allowed Values | Description |
|---|---|---|---|---|
druid_url |
STRING | "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnection=true" |
Valid Avatica JDBC URL | Druid Avatica JDBC SQL connection URL |
lookback_hours |
INT | 2 |
Positive integer | Lookback window in hours to scan sys.tasks |
max_allowed_failed_tasks |
INT | 1 |
Positive integer | Maximum failed ingestion tasks allowed before alert |
max_task_duration_ms |
INT | 7200000 |
Positive integer | Maximum allowable running duration in milliseconds |
max_allowed_stalled_tasks |
INT | 1 |
Positive integer | Maximum stalled tasks allowed before alert |
alert_mode |
SELECT | "ALERT" |
"ALERT", "AUDIT_ONLY" |
Operational alerting mode on threshold breach |
{{ outputs.probe_ingestion_tasks.row.failed_task_count }}: Aggregate count of failed tasks within the lookback window.{{ outputs.probe_ingestion_tasks.row.stalled_task_count }}: Count of active tasks exceeding the duration ceiling.{{ outputs.probe_ingestion_tasks.row.max_running_duration_ms }}: Maximum execution duration observed among active running tasks.{{ outputs.probe_failed_task_offenders.rows }}: Structured list of top offending failed or stalled tasks with task ID, datasource, and error messages.{{ outputs.probe_worker_cluster_capacity.row.middle_manager_count }}: Active MiddleManager nodes registered in the cluster.Start a local Apache Druid single-container instance on port 8888 (avoiding host port 8080):
docker run -d
--name druid-sentinel
-p 8888:8888
apache/druid:30.0.0
Connect the Druid container to the Kestra Docker network:
docker network connect YOUR_KESTRA_NETWORK druid-sentinel
Identify your network name using docker network ls.
Configure the DRUID_USERNAME, DRUID_PASSWORD, and SLACK_WEBHOOK secrets in your Kestra environment.
Import this blueprint into your Kestra instance.
Run the flow manually with alert_mode: AUDIT_ONLY to establish baseline task metrics and verify Avatica JDBC connectivity.
Enable periodic_sentinel_schedule to begin automated 30-minute operational sweeps.
/druid/indexer/v1/task/{taskId}/shutdown to kill stalled runaway tasks.sys.segments to confirm published segments match queryable historical states.jdbc:avatica:remote:url=http://<host>:8888/druid/v2/sql/avatica/;transparent_reconnection=true. Omitting the path suffix will cause connection timeouts.localhost:8888 will resolve to the Kestra container itself. Use the container hostname (e.g. http://druid-sentinel:8888) on a shared Docker bridge network.CURRENT_TIMESTAMP - INTERVAL '2' HOUR).sys.tasks for the duration configured by Druid task retention settings (druid.indexer.storage.recentlyFinishedThreshold). Ensure lookback_hours does not exceed this retention window.