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

optimize GET /schedules internal API endpoint #1169

Merged
merged 15 commits into from
Jan 25, 2023

Conversation

joeyorlando
Copy link
Contributor

@joeyorlando joeyorlando commented Jan 20, 2023

What this PR does

Fixes slow internalGET /schedules endpoints. Using the fake-data generation script in #1128, I generated 65 calendar schedules in my local setup. This resulted in the following endpoint performance:
Screenshot 2023-01-24 at 12 03 16

The responses which show ~76 queries were run on the latest dev branch. Responses w/ ~26 queries were run on this branch.

Additionally:

  • add typing to a few methods in apps/schedules/ical_utils.py
  • document apps/api/permissions/__init__.py:user_is_authorized function

Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/1552

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated

- update types in ical_utils.py
- document user_is_authorized function
@joeyorlando joeyorlando requested review from vstpme and a team January 20, 2023 07:47
engine/apps/public_api/views/schedules.py Outdated Show resolved Hide resolved
@joeyorlando joeyorlando added the pr:no public docs Added to a PR that does not require public documentation updates label Jan 20, 2023
@vstpme vstpme marked this pull request as draft January 23, 2023 14:07
@joeyorlando joeyorlando changed the title reduce # of SQL queries for GET /schedules endpoints by >90% optimize GET /schedules internal API endpoint Jan 24, 2023
@joeyorlando joeyorlando requested a review from iskhakov January 24, 2023 11:10
@joeyorlando joeyorlando marked this pull request as ready for review January 24, 2023 11:10
@joeyorlando
Copy link
Contributor Author

kudos to @vadimkerr for helping out big time with this PR

@joeyorlando joeyorlando merged commit 3cf2fcf into dev Jan 25, 2023
@joeyorlando joeyorlando deleted the jorlando/optimize-get-schedules-endpoints branch January 25, 2023 10:08
vstpme added a commit that referenced this pull request Feb 6, 2023
# What this PR does
Fixes a bug when current on-call users for web UI and Slack user group
are incorrect.

This happens when both conditions below are true:
- Using an ICal schedule
- Email of a user in Grafana has a different case than an event in ICal
(e.g. `User@gmail.com` in Grafana, `user@gmail.com` in ICal event)

The bug was introduced by #1169

## Which issue(s) this PR fixes
#1296

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants