I have a GraphQL query that pulls back all components and associated with a specific metric of interest and creates to lists:
What I would love to do is add filters into the query itself to reduce the payload and need to post-process the results. My current query is:
query HallOfShame($after: String) {
compass {
metricDefinition(cloudId: "<CLOUD ID>", metricDefinitionId: "<METRIC ID>") {
... on CompassMetricDefinition {
name
metricSources(query:{first:50, after: $after}) {
... on CompassMetricSourcesConnection {
nodes {
values(query: {first:1}) {
... on CompassMetricSourceValuesConnection {
nodes {
value
timestamp
}
}
}
component {
name
state
typeId
url
links {
url
}
customFields {
... on CompassCustomBooleanField {
definition {
id
name
}
booleanValue
}
}
}
}
pageInfo { hasNextPage endCursor }
totalCount
}
}
}
}
}
}Now this works, but it pulls back a great deal of data I end up filtering out. For instance, I'm only interested in components with `typeId` of `SERVICE` and `status` of `ACTIVE`. Also I filter out any component with a customField named `excludeFromHOS` with a value of `true`.
Any insight into how I might add some of this to the query itself, or refactor the query to enable such filtering / sorting? I'm afraid as our usage of Compass grows this is going to become an issue with timeouts (already seeing them on occasion).
Love the query name @Keith Framnes 😄
I know that "metricSources" connection primarily supports pagination arguments (which you've already used). But I couldn't find anything related to other properties like typeId, state, or other values.
I believe it would help if you had JQL metrics where you could incorporate filters such as ACTIVE services directly into the JQL query, but that's far from ideal. 🫤
Would be great to hear if anyone has worked with something similar and if they've found a solution. 👀
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.