Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests to Slack exceeded the rate limit #289

Closed
Matt2298 opened this issue Mar 14, 2023 · 3 comments
Closed

Requests to Slack exceeded the rate limit #289

Matt2298 opened this issue Mar 14, 2023 · 3 comments

Comments

@Matt2298
Copy link

Matt2298 commented Mar 14, 2023

Description:
When trying to create a group of sentry_issue_alerts resources, we're hitting an error whereby Slack is rate limiting the number of calls we can make to it's API. As a result, any apply jobs that run and create quite a few alerts will fail, also corrupting the terraform state.

Example
We have ~281 alerts to be created, most of which look very similar to the following definition:

resource "sentry_issue_alert" "alert_rule" {
  for_each     = var.alert_rules
  organization = var.organisation
  project      = sentry_project.project.id
  name         = each.key
  environment  = each.value.environment
  frequency    = each.value.frequency
  actions      = each.value.actions
  conditions   = each.value.conditions
  filters      = each.value.filters
  action_match = "any"
  filter_match = "all"
}

An example alert rule:

"Sentry to Slack - channel - event seen - every 30 minutes" = {
      frequency   = 30
      environment = null
      actions = [{
        id        = "sentry.integrations.slack.notify_action.SlackNotifyServiceAction",
        channel   = "#sentry-my-team",
        workspace = local.my_team_workspace_id,
        tags      = "environment,level,user"
      }]
      conditions = [{
        id = "sentry.rules.conditions.first_seen_event.FirstSeenEventCondition"
      }]
      filters = [local.filter_not_devops]
    },
  })

It would be good if the terraform provider had some way of understanding this rate limit and backing off when errors start to occur. As a result of applying the above terraform, we recieve the following error:

│ Error: PUT https://app.getsentry.com/api/0/projects/my-project/my-app/rules/1234567/: 400 map[actions:[Slack: Requests to Slack exceeded the rate limit. Please try again later.]]
│ 
│   with module.my_app.sentry_issue_alert.alert_rule["Sentry to Slack - channel - event seen - every 30 minutes"],
│   on ../module/main.tf line 29, in resource "sentry_issue_alert" "alert_rule":
│   29: resource "sentry_issue_alert" "alert_rule" {
@hakubo
Copy link

hakubo commented Apr 7, 2023

There is this PR waiting for being fixed/approved: #282

@hakubo
Copy link

hakubo commented Apr 7, 2023

also this is a duplicate: #281

@jianyuan
Copy link
Owner

You can now set the input_channel_id parameter in v0.12.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants