default-rule: &default-rule
  actionMatch: 'any'
  frequency: 30
  name: 'Send a notification for new issues'
  environment: null
  conditions:
    - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition'
      name: 'An issue is first seen'
  actions:
    - id: 'sentry.rules.actions.notify_event.NotifyEventAction'
      name: 'Send a notification'

base-rules: &base-rules
  actionMatch: 'any'
  frequency: 30
  name: 'Send a notification for new and repeated issues'
  conditions:
    - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition'
      name: 'An issue is first seen'
    - id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition'
      name: 'An issue is seen more than 10 times in 1h'
      interval: '1h'
      value: 10
    - id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition'
      name: 'An issue is seen more than 100 times in 1d'
      interval: '1d'
      value: 100
    - id: 'sentry.rules.conditions.event_frequency.EventFrequencyCondition'
      name: 'An issue is seen more than 1000 times in 1w'
      interval: '1w'
      value: 1000

be-prod-rules: &be-prod-rules
  <<: *base-rules
  environment: 'production'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-errors-be-prod'
      channel_id: 'G014LHJ0H40'
      tags: 'environment, user, url, browser, device, os, transaction'

fe-prod-rules: &fe-prod-rules
  <<: *base-rules
  environment: 'production'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-errors-fe-prod'
      channel_id: 'G014LHGAR24'
      tags: 'environment, user, url, browser, device, os, transaction'

be-uat-rules: &be-uat-rules
  <<: *base-rules
  environment: 'uat'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-errors-be-prod'
      channel_id: 'G014LHJ0H40'
      tags: 'environment, user, url, browser, device, os, transaction'

fe-uat-rules: &fe-uat-rules
  <<: *base-rules
  environment: 'uat'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-errors-fe-prod'
      channel_id: 'G014LHGAR24'
      tags: 'environment, user, url, browser, device, os, transaction'

be-stage-rules: &be-stage-rules
  <<: *base-rules
  environment: 'staging'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-errors-be-stage'
      channel_id: 'G013VBDD9HB'
      tags: 'environment, user, url, browser, device, os, transaction'

fe-stage-rules: &fe-stage-rules
  <<: *base-rules
  environment: 'staging'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-errors-fe-stage'
      channel_id: 'G0149B9AWE5'
      tags: 'environment, os, expoAppVersion, device, deviceId, release'

go-fe-prod-rules: &go-fe-prod-rules
  <<: *base-rules
  environment: 'production'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-go-errors-fe-prod'
      channel_id: 'G01426BNVPZ'
      tags: 'environment, os, expoAppVersion, device, deviceId, release'

go-fe-stage-rules: &go-fe-stage-rules
  <<: *base-rules
  environment: 'staging'
  actions:
    - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
      name: 'Send a notification'
      workspace: '1'
      channel: 'apollo-go-errors-fe-stage'
      channel_id: 'G0156PDKEKS'
      tags: 'environment, os, expoAppVersion, device, deviceId, level'

projects:
  apollo-api:
    id: 4
    name: 'apollo-api'
    slug: 'apollo-api'
    rules:
      - id: 195
        <<: *default-rule
      - id: 196
        <<: *be-prod-rules
      - id: 197
        <<: *be-uat-rules
      - id: 198
        <<: *be-stage-rules
      - id: 199
        name: 'twillio'
        frequency: 5
        environment: 'production'
        actionMatch: 'all'
        conditions:
          - id: 'sentry.rules.conditions.event_attribute.EventAttributeCondition'
            name: "An event's http.url value ends with /api/v1/twilio/messaging-status-callback/"
            match: 'ew'
            attribute: 'http.url'
            value: '/api/v1/twilio/messaging-status-callback/'
        actions:
          - id: 'sentry.integrations.slack.notify_action.SlackNotifyServiceAction'
            name: 'Send a notification to slack'
            workspace: '1'
            channel: 'apollo-errors-be-prod'
            channel_id: 'G014LHJ0H40'
            tags: 'environment, user, url, browser, device, os, transaction'
  apollo_api_healthcheck:
    id: 42
    name: 'apollo_api_healthcheck'
    slug: 'apollo_api_healthcheck'
    rules:
      - id: 200
        <<: *default-rule
  apple_charts_notifications:
    id: 16
    name: 'apple_charts_notifications'
    slug: 'apple_charts_notifications'
    rules:
      - id: 201
        <<: *default-rule
  appleMusicChartsJob:
    id: 10
    name: 'appleMusicChartsJob'
    slug: 'applemusicchartsjob'
    rules:
      - id: 202
        <<: *default-rule
  apple_playlists_additions_notifications:
    id: 17
    name: 'apple_playlists_additions_notifications'
    slug: 'apple_playlists_additions_noti'
    rules:
      - id: 203
        <<: *default-rule
  apple_top_playlists_aggregation:
    id: 18
    name: 'apple_top_playlists_aggregation'
    slug: 'apple_top_playlists_aggregatio'
    rules:
      - id: 204
        <<: *default-rule
  auth0_block_users:
    id: 19
    name: 'auth0_block_users'
    slug: 'auth0_block_users'
    rules:
      - id: 205
        <<: *default-rule
  backfill_missing_charts_data:
    id: 41
    name: 'backfill_missing_charts_data'
    slug: 'backfill_missing_charts_data'
    rules:
      - id: 206
        <<: *default-rule
  copy_auth0_logs_to_cloudwatch:
    id: 20
    name: 'copy_auth0_logs_to_cloudwatch'
    slug: 'copy_auth0_logs_to_cloudwatch'
    rules:
      - id: 207
        <<: *default-rule
  copy_track_playlist_history_last_week:
    id: 44
    name: 'copy_track_playlist_history_last_week'
    slug: 'copy_track_playlist_history_last_week'
    rules:
      - id: 208
        <<: *default-rule
  dsp-api:
    id: 7
    name: 'dsp-api'
    slug: 'dsp-api'
    rules:
      - id: 209
        <<: *default-rule
      - id: 234
        <<: *be-prod-rules
  fetchAppleMusicChartPlaylistTracksJob:
    id: 12
    name: 'fetchAppleMusicChartPlaylistTracksJob'
    slug: 'fetchapplemusicchartplaylisttr'
    rules:
      - id: 210
        <<: *default-rule
  fetchspotifychartsjob:
    id: 11
    name: 'fetchspotifychartsjob'
    slug: 'fetchspotifychartsjob'
    rules:
      - id: 211
        <<: *default-rule
  filtr-admin:
    id: 5
    name: 'filtr-admin'
    slug: 'filtr-admin'
    rules:
      - id: 212
        <<: *default-rule
      - id: 213
        <<: *fe-prod-rules
      - id: 214
        <<: *fe-uat-rules
      - id: 215
        <<: *fe-stage-rules
  filtr-admin-api:
    id: 29
    name: 'filtr-admin-api'
    slug: 'filtr-admin-api'
    rules:
      - id: 216
        <<: *default-rule
  filtr-privateapi:
    id: 6
    name: 'filtr-privateapi'
    slug: 'filtr-privateapi'
    rules:
      - id: 217
        <<: *default-rule
  handle_user_changes:
    id: 21
    name: 'handle_user_changes'
    slug: 'handle_user_changes'
    rules:
      - id: 218
        <<: *default-rule
  lambda_failures_notifications:
    id: 30
    name: 'lambda_failures_notifications'
    slug: 'lambda_failures_notifications'
    rules:
      - id: 219
        <<: *default-rule
  retrieve_and_save_mobile_versions:
    id: 28
    name: 'retrieve_and_save_mobile_versions'
    slug: 'retrieve_and_save_mobile_versi'
    rules:
      - id: 220
        <<: *default-rule
  send-push-notifications:
    id: 15
    name: 'send-push-notifications'
    slug: 'send-push-notifications'
    rules:
      - id: 221
        <<: *default-rule
  smart_cache:
    id: 25
    name: 'smart_cache'
    slug: 'smart_cache'
    rules:
      - id: 222
        <<: *default-rule
  spotify_charts_notifications:
    id: 22
    name: 'spotify_charts_notifications'
    slug: 'spotify_charts_notifications'
    rules:
      - id: 223
        <<: *default-rule
  spotify_playlists_additions_notifications:
    id: 23
    name: 'spotify_playlists_additions_notifications'
    slug: 'spotify_playlists_additions_no'
    rules:
      - id: 224
        <<: *default-rule
  track_visit_events_handling:
    id: 24
    name: 'track_visit_events_handling'
    slug: 'track_visit_events_handling'
    rules:
      - id: 225
        <<: *default-rule
  update_market_vendors:
    id: 40
    name: 'update_market_vendors'
    slug: 'update_market_vendors'
    rules:
      - id: 226
        <<: *default-rule
  update_streams_cache:
    id: 43
    name: 'update_streams_cache'
    slug: 'update_streams_cache'
    rules:
      - id: 227
        <<: *default-rule
  update_track_playlist_history:
    id: 26
    name: 'update_track_playlist_history'
    slug: 'update_track_playlist_history'
    rules:
      - id: 228
        <<: *default-rule
      - id: 229
        <<: *be-prod-rules
  apollo-go:
    id: 14
    name: 'apollo-go'
    slug: 'apollo-go'
    rules:
      - id: 14
        <<: *default-rule
      - id: 232
        <<: *go-fe-prod-rules
      - id: 233
        <<: *go-fe-stage-rules
