Webhook icon
Schedule icon
WorkingDirectory icon
Clone icon
Commands icon
Docker icon
Switch icon
SlackIncomingWebhook icon
Fail icon
Log icon

Meltano ELT Pipeline State Drift and Freshness Gate

Audit Meltano ELT pipelines in Kestra to detect Singer state bookmark stagnation, catch upstream schema drift, and gate warehouse loading before job execution.

Categories
Data

Prevents silent data pipeline failures, stale analytics dashboards, and corrupted data warehouse loads by orchestrating Meltano to audit Singer replication bookmarks, calculate state cursor staleness, and detect upstream schema evolution before running production ELT jobs.

How it works

  1. Pre-Flight Ingestion (elt_pre_flight_webhook, hourly_state_freshness_schedule): Triggered immediately before scheduled warehouse loads via authenticated webhook, or runs on an hourly schedule to monitor replication cursor progression across high-throughput data taps.
  2. Isolated Project Checkout (clone_meltano_repo): Clones the Meltano project repository within an isolated io.kestra.plugin.core.flow.WorkingDirectory to read committed meltano.yml plugin manifests and stream selection rules.
  3. Singer State & Schema Audit (audit_meltano_pipeline): Executes a containerized Python task on Docker (io.kestra.plugin.scripts.shell.Commands) that runs meltano install, calls meltano state get {{ inputs.state_id }} against the project's configured state backend, parses stream-level replication bookmarks (including partitioned state), computes timestamp delta against current UTC time, and, when check_schema_drift is enabled, runs meltano invoke <extractor> --discover for each configured extractor and flags any discovered stream not covered by its select rules in meltano.yml.
  4. Governance Decision Routing (route_governance_decision): Evaluates findings via io.kestra.plugin.core.flow.Switch:
    • STATE_BOOKMARK_STAGNANT: Dispatches a high-priority incident alert to Slack (alert_stagnant_state_slack) and halts execution via io.kestra.plugin.core.execution.Fail to prevent downstream models from running on stale data.
    • SCHEMA_DRIFT_DETECTED: Alerts data platform engineers of unmapped API fields before unexpected columns break strict warehouse schemas.
    • PIPELINE_SYNCHRONIZED_HEALTHY (Default): Logs an audit certification receipt (log_clean_synchronization) confirming state bookmarks are fresh and authorizes downstream transformations.

What you get

  • Silent Failure Prevention: Detects when Singer taps exit cleanly without advancing bookmarks due to silent upstream API rate limits or pagination bugs.
  • Freshness SLA Enforcement: Enforces hard data freshness limits before kicking off expensive multi-hour dbt warehouse transformations.
  • Schema Contract Protection: Flags unmapped or modified upstream fields before they cause schema validation crashes in ClickHouse, Snowflake, BigQuery, or DuckDB.
  • Audit-Ready DataOps Trail: Maintains structured logs and Slack summaries detailing stream replication keys, cursor timestamps, and observed lag metrics.

Who it's for

  • Data Engineers & Analytics Engineers operating declarative Meltano ELT pipelines feeding enterprise data warehouses and lakehouses.
  • DataOps Teams enforcing data contracts, freshness SLAs, and pipeline observability across dozens of Singer connectors.
  • Platform Architects orchestrating hybrid data integration stacks alongside dbt, DuckDB, and Kestra.

Why orchestrate this with Kestra

  • End-to-End Orchestration Control: Coordinates Git checkout, state inspection, policy branching, and incident alerting in a single declarative YAML workflow.
  • Dual Event & Schedule Triggers: Combines real-time webhook gating prior to pipeline triggers with automated cron schedules for continuous SLA surveillance.
  • Secret Masking & Security: Injects database passwords, API tokens, and webhook secrets securely through {{ secret('NAME') }} without logging sensitive credentials.

Prerequisites

  • A running Kestra v2.0 instance with Docker task runner support (plugin-scripts-runner-docker).
  • Network access to clone the Meltano project Git repository.

Secrets

  • MELTANO_WEBHOOK_KEY: Secret authentication key used to validate incoming ELT pre-flight webhook calls (required).
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL for alerting on state stagnation and schema drift (optional).
  • GITHUB_TOKEN: Personal Access Token for cloning private Meltano project repositories (optional).

Quick start

  1. Configure MELTANO_WEBHOOK_KEY in your Kestra namespace secrets.
  2. Import this blueprint into your Kestra instance under the company.data namespace.
  3. Click Execute with default inputs to audit the real Meltano demo project. If the project has never been run before, state_id will not resolve to any recorded state yet; run meltano run <job> once against your own project first, or point state_id at a job that has already executed at least once.
  4. Set git_repository_url to your team's Meltano repository to audit production pipelines.
  5. Trigger this flow prior to your daily warehouse load to ensure zero-stagnation data ingestion.

How to extend

  • Downstream Warehouse Load Triggering: Add a downstream io.kestra.plugin.core.flow.SubflowExecution task inside the defaults branch to automatically trigger the production ELT pipeline once state freshness is certified.
  • Multi-Tap Fan-Out: Wrap the state inspection logic in an io.kestra.plugin.core.flow.Parallel task to audit multiple Singer taps (Stripe, Salesforce, Zendesk) concurrently.
  • Automatic State Reset: Add an automated remediation task to reset corrupted bookmarks via meltano state set during non-critical test runs.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.