Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Infra UI] Refactor map endpoint (#21819)
While working on the porting the WaffleMap over to the Infra UI I noticed that the map endpoint would need to allow for the group by and metrics to be programmatically created. The query schema did not allow for this. This PR changes to the map query schema to allow for the user to define the grouping and metrics as request variable. Grouping are renamed to paths and the last value on the path argument is the "node" type. When the documents are returned each node will have a unique path; the path will be used to generate the groups and squares (nodes) on the waffle map. #### Example Test Query: ```graphql { source(id: "default") { id map(timerange: { interval: "1m", to:1532549840415, from: 1532546240416}, filters: []) { nodes(path: [ { id: "1", type: terms, field: "metricset.module" }, { id: "2", type: terms, field: "metricset.name" }, { id: "3", type: hosts } ]) { path { value } metrics(metrics: [{ type: count }]) { name value } } } } } ``` #### Example Response ```json { "data": { "source": { "id": "default", "map": { "nodes": [ { "path": [ { "value": "system" }, { "value": "process" }, { "value": "demo-stack-mysql-01" } ], "metrics": [ { "name": "count", "value": 5971 } ] }, { "path": [ { "value": "system" }, { "value": "diskio" }, { "value": "demo-stack-mysql-01" } ], "metrics": [ { "name": "count", "value": 5971 } ] } ] } } } } ```
- Loading branch information