Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Apache Hudi Commit Metadata Staleness Watchdog

Audits Apache Hudi lakehouse table timeline commits on object storage, detects stalled delta commits and pipeline halts, alerting via Slack.

Categories
CloudData

Audits Apache Hudi lakehouse table timeline commit metadata directly from object storage (.hoodie/ directory), detecting stalled streaming delta commits, compaction pipeline deadlocks, and ingestion engine halts before downstream BI reports degrade.

How it works

  1. Object Storage Metadata Interrogation: Lists and inspects the .hoodie/ metadata directory within Amazon S3 or compatible object storage using optimized prefix scanning.
  2. Timeline Instant Extraction: Parses active and completed .commit and .deltacommit metadata files to identify the most recent completed transaction instant.
  3. Staleness Duration Calculation: Computes the elapsed time in minutes between the latest valid commit instant and the current UTC execution timestamp.
  4. DataOps Notification and Manifest Export: Dispatches high-priority Slack notifications to data engineering teams if commit intervals exceed acceptable thresholds.

Architecture diagram

flowchart TD
    A[periodic_hudi_audit Schedule Trigger] --> B[scan_hudi_timeline_metadata Python Script]
    B --> C[check_commit_staleness Flowable If]
    C -- Threshold Breached --> D[notify_slack_data_alert Webhook]
    C -- Metrics Nominal --> E[log_nominal_hudi_state Log]
    D --> E
    E --> F[export_hudi_manifest Return]

Architecture components

  • Trigger (periodic_hudi_audit): Drives scheduled recurring surveillance cycles without human intervention.
  • Inspection Task (scan_hudi_timeline_metadata): Queries target APIs and structures diagnostic indicators via Kestra outputs.
  • Evaluation Gate (check_commit_staleness): Evaluates operational safety boundaries using deterministic boolean branching.
  • Notification Action (notify_slack_data_alert): Dispatches rich, actionable incident messages directly to team channels.
  • Manifest Return (export_hudi_manifest): Emits structured compliance payloads for SIEM and analytics records.

Key capabilities

  • Automated Health Polling: Continuous scheduled surveillance executed on customizable recurring intervals without dedicated agent daemons.
  • Deterministic Threshold Evaluation: Pure boolean and numeric tolerance checks eliminating false positives and alert noise.
  • Contextual Incident Notification: Rich Slack messages populated with explicit resource identifiers, error reasons, and metrics.
  • Machine-Readable Audit Manifest: Structured execution telemetry exported for compliance archives, SIEM ingestion, or analytics dashboards.

What you get

  • Proactive discovery of halted Spark Streaming, Flink, or DeltaStreamer ingestion pipelines
  • Zero dependency on running Spark clusters to inspect Apache Hudi timeline health
  • Protection against downstream data freshness SLA violations in analytical data warehouses
  • Auditable execution manifest containing commit instant identifiers and timeline staleness metrics

Who it's for

  • Data Platform Engineers maintaining real-time streaming lakehouses built with Apache Hudi
  • DataOps Engineers accountable for streaming data pipeline freshness and SLA guarantees
  • Analytics Engineers relying on continuous change data capture (CDC) replication for reporting

Why orchestrate this with Kestra

  • Serverless S3 metadata inspection running without spinning up costly Spark or EMR compute nodes
  • Secure IAM credential management utilizing Kestra namespace encrypted secrets
  • Reliable scheduled execution operating seamlessly on flexible cron cadences
  • Unified alerting logic directing operational issues to Slack, PagerDuty, or downstream remediation flows

Use cases

  • Flink Checkpointing Stall Detection: Detect silent Flink checkpointing failures causing uncommitted Apache Hudi transactions.
  • Spot Instance Spark Eviction Auditing: Monitor Spark structured streaming jobs that crashed due to cluster spot instance evictions.
  • MOR Compaction Progress Verification: Audit asynchronous table compaction job progress on high-throughput Merge-on-Read tables.

Inputs

Name Type Default Description
storage_bucket STRING prod-lakehouse-data-lake Amazon S3 or object storage bucket name storing the Apache Hudi table files.
table_prefix STRING hudi/events_clickstream_v1 S3 object key prefix pointing to the root directory of the Apache Hudi table containing .hoodie metadata.
table_name STRING events_clickstream_v1 Human-readable name of the Apache Hudi lakehouse table for reporting.
max_staleness_minutes INT 45 Maximum tolerated duration in minutes without new completed commits before triggering an alert.
aws_region STRING us-east-1 AWS cloud region where the target lakehouse storage bucket is hosted.
alert_on_stale BOOL True Toggle whether Slack webhook alerts are dispatched upon detecting commit timeline staleness.

Expected outputs

  • {{ outputs.scan_hudi_timeline_metadata.vars.latest_commit_instant }}: Timestamp string identifier of the latest completed commit on the Hudi timeline.
  • {{ outputs.scan_hudi_timeline_metadata.vars.commit_state }}: Operational state of the commit transaction (COMPLETED, STALLED).
  • {{ outputs.scan_hudi_timeline_metadata.vars.staleness_minutes }}: Elapsed duration in minutes since the latest successful commit was published.
  • {{ outputs.scan_hudi_timeline_metadata.vars.is_alerting }}: Boolean flag indicating whether commit staleness breached configured alert thresholds.

Prerequisites

  • Active Apache Hudi table (Copy-on-Write or Merge-on-Read) stored in Amazon S3 or S3-compatible storage.
  • AWS IAM credentials with s3:ListBucket and s3:GetObject permissions on the target lakehouse bucket.
  • Valid AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets stored in Kestra namespace secrets.
  • Configured Slack incoming webhook URL with permissions to post messages into the designated alert channel.

Secrets

  • AWS_ACCESS_KEY_ID: Vault secret required for authenticated API execution and notifications.
  • AWS_SECRET_ACCESS_KEY: Vault secret required for authenticated API execution and notifications.
  • SLACK_WEBHOOK_URL: Vault secret required for authenticated API execution and notifications.

Quick start

  1. Register the required secrets in your Kestra namespace settings.
  2. Import this blueprint into your Kestra instance under the company.data namespace.
  3. Review input parameters such as threshold levels and target resource identifiers.
  4. Execute the flow manually to verify connectivity, then enable the automated schedule.

Common pitfalls and troubleshooting

  • In-flight vs Completed Commits: Hudi creates .inflight files during processing; ensure the watchdog queries only finalized .commit or .deltacommit files.
  • Clock Skew on Instant Timestamps: Hudi instant formats use YYYYMMDDHHMMSS; calculate staleness using S3 object LastModified timestamps for authoritative time diffs.
  • Compaction Commit Suffixes: Merge-on-Read tables utilize .compaction.commit and .deltacommit; ensure regex pattern matching encompasses all active commit types.
  • S3 Bucket Versioning Overhead: On versioned S3 buckets, ensure list_objects_v2 queries target active object keys rather than historical deleted markers.

How to extend

  • Automated Ingestion Pipeline Restart: Trigger automated AWS EMR, Glue, or Kubernetes Spark job restarts when timeline staleness exceeds two hours.
  • Data Lineage Notification: Notify downstream dbt transformation models to pause execution when upstream Hudi CDC tables are stale.
  • Data Freshness Metric Publishing: Publish staleness metrics directly to Datadog or CloudWatch custom metrics for executive SLA dashboards.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.