oncall-engine/engine/apps
Joey Orlando 53ac2bcc12
fix: improve performance of recent SlackChannel related migrations (#5233)
# What this PR does

After deploying
[`r439-v1.12.0`](https://github.com/grafana/oncall-private/releases/tag/r439-v1.12.0)
to staging, I noticed that the migrations were taking a long time, and
caused some wonkiness (see
https://raintank-corp.slack.com/archives/C08063QES5N).

```bash
Apply all migrations: [redacted secret grafana-admin-creds:admin-user], alerts, auth, auth_token, base, contenttypes, email, exotel, fcm_django, google, heartbeat, labels, mobile_app, oss_installation, phone_notifications, schedules, sessions, slack, social_django, telegram, twilioapp, user_management, webhooks, zvonok
Running migrations:

source=engine:app google_trace_id=none logger=apps.alerts.migrations.0063_migrate_channelfilter_slack_channel_id Starting migration to populate slack_channel field.
source=engine:app google_trace_id=none logger=apps.alerts.migrations.0063_migrate_channelfilter_slack_channel_id Bulk updated 1 ChannelFilters with their Slack channel.
source=engine:app google_trace_id=none logger=apps.alerts.migrations.0063_migrate_channelfilter_slack_channel_id Finished migration to populate slack_channel field.
  Applying alerts.0063_migrate_channelfilter_slack_channel_id... OK

source=engine:app google_trace_id=none logger=apps.alerts.migrations.0064_migrate_resolutionnoteslackmessage_slack_channel_id Starting migration to populate slack_channel field.
source=engine:app google_trace_id=none logger=apps.alerts.migrations.0064_migrate_resolutionnoteslackmessage_slack_channel_id Bulk updated 1 ResolutionNoteSlackMessage records with their Slack channel.
source=engine:app google_trace_id=none logger=apps.alerts.migrations.0064_migrate_resolutionnoteslackmessage_slack_channel_id Finished migration to populate slack_channel field.
  Applying alerts.0064_migrate_resolutionnoteslackmessage_slack_channel_id... OK

source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Starting migration to populate slack_channel field.
source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Bulk updated 6 OnCallSchedules with their Slack channel.
source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Finished migration to populate slack_channel field.
  Applying schedules.0019_auto_20241021_1735... OK

source=engine:app google_trace_id=none logger=apps.user_management.migrations.0026_auto_20241017_1919 Starting migration to populate default_slack_channel field.
source=engine:app google_trace_id=none logger=apps.user_management.migrations.0026_auto_20241017_1919 Bulk updated 1 organizations with their default Slack channel.
source=engine:app google_trace_id=none logger=apps.user_management.migrations.0026_auto_20241017_1919 Finished migration to populate default_slack_channel field.
  Applying user_management.0026_auto_20241017_1919... OK
```

**NOTE**: wrt these migrations already being run for certain OSS stacks;
it shouldn't have much of an impact on OSS deployments, as it's really
only an issue for _very large_ versions of these tables (particularly
the `ResolutionNoteSlackMessage` table, which by its nature, has a
tendency to generate a lot of data).

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-11-06 06:02:21 -05:00
..
alerts fix: improve performance of recent SlackChannel related migrations (#5233) 2024-11-06 06:02:21 -05:00
api feat: add grafana_irm_enabled to GET /organization endpoint response (#5230) 2024-11-05 05:54:38 -05:00
api_for_grafana_incident Allow valid URLs for web image_url template (#5150) 2024-10-10 13:21:36 +00:00
auth_token Enable RBAC support for public API endpoints (#5211) 2024-10-30 09:54:55 +00:00
base Reschedule rate limited telegram task instead of retry (#5178) 2024-10-15 13:35:54 +00:00
chatops_proxy update URLs constructed by the backend to support IRM plugin (#5137) 2024-10-09 08:55:10 -04:00
email Make cloud email domain configurable (#4982) 2024-09-04 14:46:52 +00:00
exotel Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
google feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
grafana_plugin feat: persist is_grafana_irm_enabled from backend plugin sync data (#5171) 2024-10-11 14:57:59 -04:00
heartbeat Improve OpenAPI schema coverage (#3629) 2024-01-12 15:11:22 +00:00
integrations feat: convert organization.general_log_channel_id to organization.default_slack_channel (#5191) 2024-11-01 06:41:38 +01:00
labels fix: update internal labels endpoints to work with RBAC (#5099) 2024-10-02 17:39:49 +00:00
metrics_exporter Split up organizations across metrics exporters (#5127) 2024-10-08 17:29:36 +00:00
mobile_app Update schedule related users to use cached final representation (#5101) 2024-10-01 13:37:28 +00:00
oss_installation feat: update RBAC permissioning to support grafana-irm-app (#5149) 2024-10-10 19:02:21 +00:00
phone_notifications Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
public_api feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
schedules fix: improve performance of recent SlackChannel related migrations (#5233) 2024-11-06 06:02:21 -05:00
slack chore: add more slack related tests (#5227) 2024-11-04 15:49:22 -05:00
social_auth SocialAuthAuthCanceledExceptionMiddleware should only process social … (#5221) 2024-11-04 04:54:47 +00:00
telegram Fix acknowledge reminder task (#5179) 2024-10-16 12:13:28 +00:00
twilioapp Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
user_management fix: improve performance of recent SlackChannel related migrations (#5233) 2024-11-06 06:02:21 -05:00
webhooks Add manual trigger support for webhooks (#4934) 2024-09-09 12:17:23 +00:00
zvonok Add method to send notification bundle by SMS (#4624) 2024-07-16 14:20:16 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00