Skip to content

Commit

Permalink
[Infra UI] Refactor map endpoint (#21819)
Browse files Browse the repository at this point in the history
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
simianhacker authored and weltenwort committed Aug 9, 2018
1 parent 3b04b88 commit 988ecdf
Show file tree
Hide file tree
Showing 30 changed files with 536 additions and 726 deletions.
8 changes: 2 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
// Disable the breaking keyof behaviour introduced in TS 2.9.2 until EUI is updated to support that too
"keyofStringsOnly": true
},
"include": [
"src/**/*"
],
"exclude": [
"src/**/__fixtures__/**/*"
]
"include": ["src/**/*"],
"exclude": ["src/**/__fixtures__/**/*"]
}
Loading

0 comments on commit 988ecdf

Please sign in to comment.