Reduce query timespan to one day in schedule daily view
What does this MR do?
The on-call schedule timeline currently requests two weeks of data - this is the case for both the two-week view and the one-day view.
This MR ensures changes the query so that only one day is requested for the one-day view. This is a reduces server load and improves page performance.
The specs are currently being refactored in !58436 (merged) - I've added a test for this change there to minimize conflicts.
issue: #327301 (closed)
Graphql query response - before
{
"data": {
"project": {
"incidentManagementOncallSchedules": {
"nodes": [
{
"rotations": {
"nodes": [
{
"__typename": "IncidentManagementOncallRotation",
"shifts": {
"nodes": [
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-10T16:00:00Z",
"startsAt": "2021-04-10T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-11T16:00:00Z",
"startsAt": "2021-04-11T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-12T16:00:00Z",
"startsAt": "2021-04-12T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-13T16:00:00Z",
"startsAt": "2021-04-13T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-14T16:00:00Z",
"startsAt": "2021-04-14T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-15T16:00:00Z",
"startsAt": "2021-04-15T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-16T16:00:00Z",
"startsAt": "2021-04-16T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-17T16:00:00Z",
"startsAt": "2021-04-17T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-18T16:00:00Z",
"startsAt": "2021-04-18T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-19T16:00:00Z",
"startsAt": "2021-04-19T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-20T16:00:00Z",
"startsAt": "2021-04-20T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-21T16:00:00Z",
"startsAt": "2021-04-21T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-22T16:00:00Z",
"startsAt": "2021-04-22T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-23T16:00:00Z",
"startsAt": "2021-04-23T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
},
"endsAt": "2021-04-24T16:00:00Z",
"startsAt": "2021-04-24T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
}
],
"__typename": "IncidentManagementOncallShiftConnection"
},
"id": "gid://gitlab/IncidentManagement::OncallRotation/68",
"name": "8hr active period",
"startsAt": "2021-02-01T05:00:00Z",
"endsAt": null,
"length": 2,
"lengthUnit": "DAYS",
"activePeriod": {
"startTime": "20:00",
"endTime": "04:00",
"__typename": "OncallRotationActivePeriodType"
},
"participants": {
"nodes": [
{
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
{
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
}
],
"__typename": "OncallParticipantTypeConnection"
}
}
],
"__typename": "IncidentManagementOncallRotationConnection"
},
"__typename": "IncidentManagementOncallSchedule"
}
],
"__typename": "IncidentManagementOncallScheduleConnection"
},
"__typename": "Project"
}
}
}
Graphql query response - after
{
"data": {
"project": {
"incidentManagementOncallSchedules": {
"nodes": [
{
"rotations": {
"nodes": [
{
"__typename": "IncidentManagementOncallRotation",
"shifts": {
"nodes": [
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-10T16:00:00Z",
"startsAt": "2021-04-10T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
},
{
"participant": {
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
"endsAt": "2021-04-11T16:00:00Z",
"startsAt": "2021-04-11T08:00:00Z",
"__typename": "IncidentManagementOncallShift"
}
],
"__typename": "IncidentManagementOncallShiftConnection"
},
"id": "gid://gitlab/IncidentManagement::OncallRotation/68",
"name": "8hr active period",
"startsAt": "2021-02-01T05:00:00Z",
"endsAt": null,
"length": 2,
"lengthUnit": "DAYS",
"activePeriod": {
"startTime": "20:00",
"endTime": "04:00",
"__typename": "OncallRotationActivePeriodType"
},
"participants": {
"nodes": [
{
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/50",
"name": "test api key",
"username": "project_26_bot",
"avatarUrl": "https://www.gravatar.com/avatar/c7d442f57236d64d5b8b7b9f5f063bb4?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "blue"
},
{
"__typename": "OncallParticipantType",
"user": {
"id": "gid://gitlab/User/1",
"name": "Administrator",
"username": "root",
"avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"__typename": "User"
},
"colorWeight": "500",
"colorPalette": "orange"
}
],
"__typename": "OncallParticipantTypeConnection"
}
}
],
"__typename": "IncidentManagementOncallRotationConnection"
},
"__typename": "IncidentManagementOncallSchedule"
}
],
"__typename": "IncidentManagementOncallScheduleConnection"
},
"__typename": "Project"
}
}
}
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
- [n/a] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [n/a] Database guides
- [n/a] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [n/a] Tested in all supported browsers
- [n/a] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [n/a] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [n/a] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [n/a] Security reports checked/validated by a reviewer from the AppSec team
Edited by Tristan Read