oncall-engine/engine/common/api_helpers
Matias Bordese 845940d9b3
Update alert group search to force index in MySQL (#4731)
Related to https://github.com/grafana/oncall-private/issues/2679

Confirmed the query rewriting works via MySQL query logs (index is also
forced for the stats queries):

`2024-07-24T19:50:59.482751Z 3977 Query SELECT `alerts_alertgroup`.`id`
FROM `alerts_alertgroup` FORCE INDEX (`alert_group_list_index`) WHERE
(`alerts_alertgroup`.`channel_id` IN (13) AND (1) AND
(`alerts_alertgroup`.`public_primary_key` LIKE 'test' OR
`alerts_alertgroup`.`inside_organization_number` LIKE 'test' OR
`alerts_alertgroup`.`web_title_cache` LIKE '%test%') AND
`alerts_alertgroup`.`root_alert_group_id` IS NULL AND
((`alerts_alertgroup`.`silenced` = ('0') AND
`alerts_alertgroup`.`acknowledged` = ('0') AND
`alerts_alertgroup`.`resolved` = ('0')) OR
(`alerts_alertgroup`.`acknowledged` = ('1') AND
`alerts_alertgroup`.`resolved` = ('0'))) AND
`alerts_alertgroup`.`started_at` >= '2024-06-24 19:50:58' AND
`alerts_alertgroup`.`started_at` <= '2024-07-24 19:50:58') ORDER BY
`alerts_alertgroup`.`started_at` DESC LIMIT 26
`

Rewriting will only be applied to the alert group search queries, when
the feature flags are enabled. Dependency was already listed as a
requirement.
2024-07-25 09:21:32 +00:00
..
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
custom_fields.py Allow custom wait delay (#4446) 2024-06-03 13:06:47 +00:00
custom_rate_scoped_throttler.py Add ratelimit for phone number verification (#1354) 2023-02-21 16:47:52 +08:00
exceptions.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
filters.py Display human readable time ranges in AG filters (#4288) 2024-05-02 14:23:33 +00:00
mixins.py Remove unused const 2024-01-24 16:32:58 +08:00
optional_slash_router.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
paginators.py Update alert group search to force index in MySQL (#4731) 2024-07-25 09:21:32 +00:00
serializers.py Make viewset actions more consistent (#2120) 2023-06-07 12:10:53 +00:00
utils.py cleanup CustomButton backend code + add ngrok/express outgoing webhook e2e test (#2544) 2024-03-28 15:37:22 +00:00