Templates are a new way to define monitors without duplicating code.

Templates are any object that contain the templateName Key. Once that templateName is set it can be added to any monitor using the extends key. extends should be an array.

Example: Reusable Tag Templates

templateName: missionCriticalTags
tags:
  - name: Mission Critical

---

templateName: Unimportant
tags:
  - name: Unimportant

kind: Monitor
version: 1
friendlyId: myMonitor
name: My Monitor
extends:
- missionCriticalTags
...

---

kind: Monitor
version: 1
friendlyId: myOtherMonitor
name: My Other Monitor
extends:
- Unimportant
...

Templates in for Loops

templateName: customer_id_check
kind: Monitor
version: 1
friendlyId: customer_id_format_check
name: Matches Regex Monitor on CUSTOMER_ID
description: ""
incident:
  severity: Low
  message: ""
parameters:
  kind: FieldFormat
  field: CUSTOMER_ID
  format:
    kind: Regex
    regex: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"

---

for each dataset T:
  datasets:
   include:
     - uri: snowflake://sifflet-enterprise/DEMO.SE_ENV.ORDERS
     - uri: snowflake://sifflet-enterprise/DEMO.SE_ENV.CUSTOMERS
     - uri: snowflake://sifflet-enterprise/DEMO.SE_ENV.STG_CUSTOMERS
  monitors:
   - kind: Monitor
     name: "[${T.name}]Format monitor on CUSTOMER_ID" 
     extends: 
      - customer_id_check