Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra UI] Refactor map endpoint #21819

Merged

Conversation

simianhacker
Copy link
Member

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:

{
  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

{
  "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 } ]
          }
        ]
      }
    }
  }
}

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@weltenwort weltenwort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating the follow-up issues 👍 LGTM following the discussion about #21504

@weltenwort weltenwort merged commit 988ecdf into elastic:feature-infra-ui Aug 9, 2018
@simianhacker simianhacker deleted the refactor-map-endpoint branch April 17, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Metrics UI Metrics UI feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants