oncall-engine/engine/apps/api/views
Joey Orlando 52ff041066
Optimize duplicate queries occurring in AlertGroupFilter (#1809)
# What this PR does

In `AlertGroupFilter` we currently have 11 duplicate queries which add
~1-2secs of unecessary request latency to `GET
/api/internal/v1/alertgroups` calls.
![Screenshot 2023-04-20 at 17 57
49](https://user-images.githubusercontent.com/9406895/233589341-de5e53ca-f10b-4038-ad68-a857d1643bf2.png)



The queries originate from the `queryset` callable arguments on several
of the fields of the `AlertGroupFilter` class. These callables basically
filter down their respective querysets to include only objects that
belong to the currently authenticated user's organization.

The duplicate queries are
- 2 queries to fetch integrations
- 2 queries to fetch escalation chains
- 10 queries to fetch users

At the moment, this PR is still a draft and doesn't work as intended.
It's based off of [a suggestion from this
discussion](https://github.com/carltongibson/django-filter/discussions/1572#discussioncomment-5676042)
in the `django-filter` repo. See [this DjangoCon
talk](https://youtu.be/e52S1SjuUeM?t=841) for more context.

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-04-26 06:16:29 +00:00
..
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
alert_group.py Optimize duplicate queries occurring in AlertGroupFilter (#1809) 2023-04-26 06:16:29 +00:00
alert_receive_channel.py Allow use of dynamic payloads in alert receive channels preview templ… (#1756) 2023-04-18 03:57:40 +00:00
alert_receive_channel_template.py Fix resource duplication caused by available_teams_lookup_args (#1593) 2023-03-22 15:43:32 +08:00
alerts.py Add alert detail view (#385) 2022-08-19 14:03:07 +05:00
auth.py Add SLACK_INTEGRATION_MAINTENANCE env var (#1582) 2023-03-21 08:15:35 +00:00
channel_filter.py Added preview and migration API endpoints for route migration from regex into jinja2 (#1715) 2023-04-18 02:53:53 +00:00
custom_button.py Fix resource duplication caused by available_teams_lookup_args (#1593) 2023-03-22 15:43:32 +08:00
escalation_chain.py Allow changing team for escalation chains (#1658) 2023-03-30 10:43:00 +01:00
escalation_policy.py Add escalation chain support for new webhooks (#1654) 2023-04-05 12:03:55 +00:00
features.py Webhooks 2 - Add copy ID to clipboard buttons (#1753) 2023-04-18 13:03:13 -06:00
gitops.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
integration_heartbeat.py Fix resource duplication caused by available_teams_lookup_args (#1593) 2023-03-22 15:43:32 +08:00
live_setting.py Add RBAC Support (#777) 2022-11-29 09:41:56 +01:00
maintenance.py Add endpoints to start and stop maintenance in alert receive channel … (#1755) 2023-04-18 03:31:49 +00:00
on_call_shifts.py Fix resource duplication caused by available_teams_lookup_args (#1593) 2023-03-22 15:43:32 +08:00
organization.py Introduce org uuid (#947) 2022-12-06 22:42:58 +08:00
paging.py Teams redesign (#1528) 2023-03-22 00:57:20 +08:00
preview_template_options.py Fix of templates api behaviour for public and private api (#1408) 2023-03-01 16:32:15 +08:00
public_api_tokens.py Add RBAC Support (#777) 2022-11-29 09:41:56 +01:00
resolution_note.py Fix resource duplication caused by available_teams_lookup_args (#1593) 2023-03-22 15:43:32 +08:00
route_regex_debugger.py Optimize alert group list view (#299) 2022-07-27 14:14:59 +03:00
schedule.py Rework schedule ical export (#1783) 2023-04-18 17:07:11 +00:00
slack_channel.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
slack_team_settings.py Add RBAC Support (#777) 2022-11-29 09:41:56 +01:00
subscription.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
team.py Fix team update (#1794) 2023-04-19 15:22:14 +00:00
telegram_channels.py Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
test_insight_logs.py Fix propagation for the insight logger 2022-07-25 12:59:12 +04:00
user.py Update upcoming shift endpoint to return a list (#1784) 2023-04-18 16:42:04 +00:00
user_group.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
user_notification_policy.py Add mobile app auth for notification_policies endpoint (#1725) 2023-04-11 16:36:46 +00:00
webhooks.py Add escalation chain support for new webhooks (#1654) 2023-04-05 12:03:55 +00:00