---
extractors:
  component: "{{ with .JiraWebhookEvent.Issue.Fields.Components }}{{ (index . 0).Name }}{{ end }}"
  project: "{{ .JiraWebhookEvent.Issue.Fields.Project.Key }}"
  priority: "{{ .JiraWebhookEvent.Issue.Fields.Priority.Name }}"
  type: "{{ .JiraWebhookEvent.Issue.Fields.Type.Name }}"
  webhook_event: "{{ .JiraWebhookEvent.WebhookEvent }}"
  changed_fields: "{{range .JiraWebhookEvent.Changelog.Items}}<{{.Field}}>{{end}}"
  summary: "{{ .JiraWebhookEvent.Issue.Fields.Summary }}"
  # MIGRATE RELATED
  alert_required: "{{ with .JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10223 }}{{ .value }}{{ end }}"
  alarm: "{{ with .JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10150 }}{{ .value }}{{ end }}"
  account_code: "{{ .JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10217 }}"
  visibility: "{{ (.JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10160 | tryUnmarshalJson).labels.visibility }}"
  status_cat: "{{ .JiraWebhookEvent.Issue.Fields.Status.StatusCategory.Key }}"
  provider_type: "{{ (.JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10160 | tryUnmarshalJson).labels.provider_type }}"
  o11y_biz_type: "{{ (.JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10160 | tryUnmarshalJson).labels.o11y_biz_type }}"
  tenant_id: "{{ .JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10157 }}"
  cluster_id: "{{ .JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10149 }}"
  alertname: "{{ (.JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10160 | tryUnmarshalJson).labels.alertname }}"
  kind: "{{ .JiraWebhookEvent.Issue.Fields.Unknowns.customfield_10159 }}"
routes:
  # - receiver: test-assign
  #   continue: true
  #   match:
  #     project: ^O11YDEV$
  #     webhook_event: jira:issue_created
  #     summary: ^TEST
  - receiver: guardian-analysis
    continue: true
    match:
      project: ^O11YDEV$
      webhook_event: jira:issue_created
      type: ^Task$
      priority: Critical|Major
      alertname: ^(Total|Max)Ti(DB|KV|Flash)(Memory|CPU)UsageTooHigh$
  # - receiver: test-notify-card
  #   continue: true
  #   match:
  #     project: ^O11YDEV$
  #     webhook_event: jira:issue_created
  #     summary: ^TEST