Automated API SLA and Data Drift Quarantine Pipeline
Runs parallel endpoint probes, aggregates batch metrics in DuckDB, scores drift in Python, and quarantines bad partitions.
Audit Snowflake query and attribution history for query tag compliance, quantify unallocated compute credit spend, and alert FinOps on Slack.
Automated Snowflake FinOps watchdog auditing SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY and QUERY_ATTRIBUTION_HISTORY for query tag compliance. Identifies untagged warehouse workloads, attributes unallocated compute credits and estimated dollar cost, and alerts FinOps teams on Slack when non-compliance exceeds organizational thresholds.
In enterprise cloud data platforms, finance and engineering leadership rely on Snowflake Query Tags (QUERY_TAG) to map warehouse compute costs to business units, cost centers, microservices, and dbt models. When queries run without tags, compute charges fall into an unallocated "black hole," breaking FinOps chargeback models.
This blueprint automates continuous query tagging governance:
QUERY_TAG IS NULL OR TRIM(QUERY_TAG) = '').daily_tagging_audit or manually with custom lookback hours.audit_query_tag_compliance task executes an optimized SQL aggregation against snowflake.account_usage.query_history, filtering for successful warehouse queries and calculating the untagged percentage.fetch_offending_roles_summary task isolates the top roles, users, and virtual warehouses driving the highest volume of untagged queries.evaluate_tagging_compliance conditional task compares the computed untagged percentage against inputs.max_untagged_percentage_threshold.notify_finops_slack sends a detailed Slack notification highlighting the offending role, user, warehouse, and remediation commands.log_nominal_tagging logs a confirmation message.export_governance_manifest task records a JSON summary of the audit for ingestion into cloud governance dashboards.Snowflake resource monitors manage warehouse quotas but cannot enforce tagging policies or inspect session metadata. Kestra orchestrates the entire governance lifecycle declaratively: connecting securely through JDBC, inspecting account-wide usage views, branching on FinOps compliance thresholds, and notifying engineering stakeholders directly where they work.
| Name | Type | Default | Description |
|---|---|---|---|
lookback_hours |
INT | 24 |
Number of hours of historical query activity to audit. |
max_untagged_percentage_threshold |
FLOAT | 5.0 |
Maximum acceptable percentage of untagged queries before triggering an alert. |
credit_price_usd |
FLOAT | 3.00 |
Estimated dollar cost per Snowflake compute credit. |
max_offending_roles_to_list |
INT | 5 |
Maximum number of offending roles and users to list in the breakdown. |
slack_channel |
STRING | #finops-governance |
Slack channel destination for FinOps query tag governance alerts. |
{{ outputs.audit_query_tag_compliance.row }}: Aggregated metrics including TOTAL_WAREHOUSE_QUERIES, UNTAGGED_QUERIES, UNTAGGED_PERCENTAGE, UNTAGGED_COMPUTE_CREDITS, ESTIMATED_UNTAGGED_COST_USD, and UNTAGGED_EXECUTION_HOURS.{{ outputs.fetch_offending_roles_summary.rows }}: Array of top offending roles, users, and warehouses with individual UNTAGGED_QUERY_COUNT values.{{ outputs.evaluate_tagging_compliance }}: Status of the conditional SLA evaluation.{{ outputs.export_governance_manifest.value }}: Structured JSON telemetry manifest recording compliance state and timestamp.SNOWFLAKE.ACCOUNT_USAGE schema.IMPORTED PRIVILEGES on the SNOWFLAKE database.SNOWFLAKE_JDBC_URL: Snowflake JDBC connection string (e.g. jdbc:snowflake://<account_locator>.snowflakecomputing.com?warehouse=COMPUTE_WH&db=SNOWFLAKE&schema=ACCOUNT_USAGE).SNOWFLAKE_USER: Username of the service account authorized to query account usage.SNOWFLAKE_PASSWORD: Password for the Snowflake service account.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for sending alert notifications.SNOWFLAKE_JDBC_URL, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, and SLACK_WEBHOOK_URL in your Kestra namespace secrets.SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY updates within 45 minutes, QUERY_ATTRIBUTION_HISTORY lags by up to a few hours before compute credits are allocated. Running audits with a 24-hour lookback window ensures consistent and reconciled metrics rather than zero attribution for very recent queries.cost_center), extend the WHERE clause to check TRY_PARSE_JSON(query_tag):cost_center IS NOT NULL.ANALYTICS_WH, ETL_WH) to apply stricter tagging thresholds.