diff --git a/knowledge_base/alerts/resources/nyc_taxi_daily_revenue.alert.yml b/knowledge_base/alerts/resources/nyc_taxi_daily_revenue.alert.yml index 64c119b..e107523 100644 --- a/knowledge_base/alerts/resources/nyc_taxi_daily_revenue.alert.yml +++ b/knowledge_base/alerts/resources/nyc_taxi_daily_revenue.alert.yml @@ -48,3 +48,16 @@ resources: pause_status: "UNPAUSED" quartz_cron_schedule: "0 0 8 * * ?" # Run daily at 8 AM UTC timezone_id: "UTC" + + # This alert is configured identically to the above alert, but it refers to a .dbalert.json file + # instead of inlining the configuration in YAML. We recommend inlining the configuration in YAML + # when you need to productionize the alert across different target (dev, staging, prod) and + # using a .dbalert.json file when you have a single target alert that you author in the Databricks UI + # or using the databricks bundle generate alert command. + nyc_taxi_daily_revenue_as_file: + permissions: + - level: CAN_MANAGE + user_name: user@company.com + display_name: "NYC Taxi Daily Revenue Alert as File" + warehouse_id: ${var.warehouse_id} + file_path: ./nyc_taxi_daily_revenue_as_file.dbalert.json diff --git a/knowledge_base/alerts/resources/nyc_taxi_daily_revenue_as_file.dbalert.json b/knowledge_base/alerts/resources/nyc_taxi_daily_revenue_as_file.dbalert.json new file mode 100644 index 0000000..270356d --- /dev/null +++ b/knowledge_base/alerts/resources/nyc_taxi_daily_revenue_as_file.dbalert.json @@ -0,0 +1,35 @@ +{ + "custom_summary": "Alert when NYC Taxi daily revenue exceeds threshold", + "evaluation": { + "source": { + "name": "amount", + "display": "amount", + "aggregation": "MAX" + }, + "comparison_operator": "GREATER_THAN", + "threshold": { + "value": { + "double_value": 1000000.0 + } + }, + "notification": { + "retrigger_seconds": 3600, + "notify_on_ok": false + } + }, + "schedule": { + "quartz_cron_schedule": "0 0 8 * * ?", + "timezone_id": "UTC" + }, + "query_lines": [ + "SELECT", + " to_date(tpep_pickup_datetime) as date,", + " SUM(fare_amount) as amount", + "FROM", + " `samples`.`nyctaxi`.`trips`", + "GROUP BY", + " ALL", + "ORDER BY", + " 1 DESC" + ] +}