Spike: PMG query optimization
While we are building out the GraphQL pipeline mini graph, we need to look into whether our queries still make sense.
We are considering consolidating getPipelineStages
and getLinkedPipelines
into one query getPipelineMiniGraph
for our initial query. Considerations exist in the architectural blueprint.
Note - This is simply the approach for the initial rendering of the component. All other data (read: dropdown data) will occur farther down the chain in the implementation.
Current Queries
Pipeline Stages
query getPipelineStages($fullPath: ID!, $iid: ID!) {
project(fullPath: $fullPath) {
id
pipeline(iid: $iid) {
id
stages {
nodes {
id
name
detailedStatus {
id
icon
group
}
}
}
}
}
}
Linked pipelines
query getLinkedPipelines($fullPath: ID!, $iid: ID!) {
project(fullPath: $fullPath) {
id
pipeline(iid: $iid) {
id
path
downstream {
nodes {
id
path
project {
id
name
}
detailedStatus {
id
group
icon
label
}
sourceJob {
id
retried
}
}
}
upstream {
id
path
project {
id
name
}
detailedStatus {
id
group
icon
label
}
}
}
}
}
Proposed Query
query getPipelineMiniGraph() {
project(fullPath: $fullPath) {
id
pipeline(iid: $iid) {
id
path
downstream {
nodes {
id
path
project {
id
name
}
detailedStatus {
id
group
icon
label
}
sourceJob {
id
retried
}
}
}
upstream {
id
path
project {
id
name
}
detailedStatus {
id
group
icon
label
}
}
stages {
nodes {
id
name
detailedStatus {
id
icon
group
}
}
}
}
}
}
Other options include:
- Leaving the queries as-is but making sure they exist in the same directory
- Breaking down the queries even further
Our path forward will be determined by what we learn from experimenting with the query optimization.
Edited by Briley Sandlin