Improve the `instanceSecurityDashboard#vulnerabilityGrades` GraphQL query
Why are we doing this work
The instanceSecurityDashboard#vulnerabilityGrades
GraphQL query is responding really slow. In addition to its slowness, currently, it does not support fetching the projects for a single letter grade which makes it impossible to list all the projects for a letter grade if there are more than 100 projects in that letter grade.
Performance characteristics
Fetching the letter grade with projects
query getGrades {
instanceSecurityDashboard {
vulnerabilityGrades {
projects {
pageInfo {
endCursor
hasNextPage
}
nodes {
name
}
}
grade
count
}
}
}
Fetching only the letter grade and the number of projects
query getGrades {
instanceSecurityDashboard {
vulnerabilityGrades {
grade
count
}
}
}
After implementing the filtering option by letter grade, we can change the frontend logic to lazy load the projects to reduce the pressure on backend;
query getGrades {
instanceSecurityDashboard {
vulnerabilityGrades(letterGrade: "F") {
projects {
pageInfo {
endCursor
hasNextPage
}
nodes {
name
}
}
}
}
}
This way we can load the "Project security status" widget way faster and prevent loading unnecessary data from the server.
Implementation plan
-
backend Add filtering by letter grade option to the instanceSecurityDashboard#vulnerabilityGrades
field.