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

[Stack Monitoring] Convert node roles into array #167628

Merged
merged 13 commits into from Oct 4, 2023

Conversation

tonyghiani
Copy link
Contributor

@tonyghiani tonyghiani commented Sep 29, 2023

📓 Summary

When the elasticsearch.node.roles property is set to a single role, the API returns a single string instead of a list, failing when computing the role list client side and resulting in an empty list.

This fix is to parse the node roles into a list if the API returns a single role string and correctly displays the roles.

E.g. Assuming we have the following roles configuration

[
      {
        "_source": {
          "elasticsearch": {
            "node": {
              "roles": [
                "data",
                "master"
              ]
            }
          }
        }
      },
      {
        "_source": {
          "elasticsearch": {
            "node": {
              "roles": "master"
            }
          }
        }
      }
    ]

It would fail at parsing the second node roles and fall back into the "coordinating only" default.

Screenshot 2023-09-29 at 13 05 14

@tonyghiani tonyghiani added release_note:fix Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services backport:prev-minor Backport to the previous minor version (i.e. one version back from main) labels Sep 29, 2023
@tonyghiani tonyghiani requested a review from a team as a code owner September 29, 2023 11:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
monitoring 462.4KB 462.4KB +31.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@tonyghiani tonyghiani merged commit a69957e into elastic:main Oct 4, 2023
19 checks passed
@tonyghiani tonyghiani deleted the fix-node-roles-list branch October 4, 2023 08:50
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 4, 2023
## 📓 Summary

When the `elasticsearch.node.roles` property is set to a single role,
the API returns a single string instead of a list, failing when
computing the role list client side and resulting in an empty list.

This fix is to parse the node roles into a list if the API returns a
single role string and correctly displays the roles.

E.g. Assuming we have the following roles configuration
```
[
      {
        "_source": {
          "elasticsearch": {
            "node": {
              "roles": [
                "data",
                "master"
              ]
            }
          }
        }
      },
      {
        "_source": {
          "elasticsearch": {
            "node": {
              "roles": "master"
            }
          }
        }
      }
    ]

```

It would fail at parsing the second node roles and fall back into the
"coordinating only" default.

<img width="814" alt="Screenshot 2023-09-29 at 13 05 14"
src="https://github.com/elastic/kibana/assets/34506779/bf49a974-650a-44cc-827b-b3dc834d6cee">

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
(cherry picked from commit a69957e)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.10

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 4, 2023
…67966)

# Backport

This will backport the following commits from `main` to `8.10`:
- [[Stack Monitoring] Convert node roles into array
(#167628)](#167628)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marco Antonio
Ghiani","email":"marcoantonio.ghiani01@gmail.com"},"sourceCommit":{"committedDate":"2023-10-04T08:50:07Z","message":"[Stack
Monitoring] Convert node roles into array (#167628)\n\n## 📓
Summary\r\n\r\nWhen the `elasticsearch.node.roles` property is set to a
single role,\r\nthe API returns a single string instead of a list,
failing when\r\ncomputing the role list client side and resulting in an
empty list.\r\n\r\nThis fix is to parse the node roles into a list if
the API returns a\r\nsingle role string and correctly displays the
roles.\r\n\r\nE.g. Assuming we have the following roles
configuration\r\n```\r\n[\r\n {\r\n \"_source\": {\r\n
\"elasticsearch\": {\r\n \"node\": {\r\n \"roles\": [\r\n \"data\",\r\n
\"master\"\r\n ]\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"_source\": {\r\n
\"elasticsearch\": {\r\n \"node\": {\r\n \"roles\": \"master\"\r\n }\r\n
}\r\n }\r\n }\r\n ]\r\n\r\n```\r\n\r\nIt would fail at parsing the
second node roles and fall back into the\r\n\"coordinating only\"
default.\r\n\r\n<img width=\"814\" alt=\"Screenshot 2023-09-29 at 13 05
14\"\r\nsrc=\"https://github.com/elastic/kibana/assets/34506779/bf49a974-650a-44cc-827b-b3dc834d6cee\">\r\n\r\nCo-authored-by:
Marco Antonio Ghiani
<marcoantonio.ghiani@elastic.co>","sha":"a69957e0fc821b9644a70df2a57ccb672fd71001","branchLabelMapping":{"^v8.11.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Infra
Monitoring
UI","backport:prev-minor","v8.11.0"],"number":167628,"url":"#167628
Monitoring] Convert node roles into array (#167628)\n\n## 📓
Summary\r\n\r\nWhen the `elasticsearch.node.roles` property is set to a
single role,\r\nthe API returns a single string instead of a list,
failing when\r\ncomputing the role list client side and resulting in an
empty list.\r\n\r\nThis fix is to parse the node roles into a list if
the API returns a\r\nsingle role string and correctly displays the
roles.\r\n\r\nE.g. Assuming we have the following roles
configuration\r\n```\r\n[\r\n {\r\n \"_source\": {\r\n
\"elasticsearch\": {\r\n \"node\": {\r\n \"roles\": [\r\n \"data\",\r\n
\"master\"\r\n ]\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"_source\": {\r\n
\"elasticsearch\": {\r\n \"node\": {\r\n \"roles\": \"master\"\r\n }\r\n
}\r\n }\r\n }\r\n ]\r\n\r\n```\r\n\r\nIt would fail at parsing the
second node roles and fall back into the\r\n\"coordinating only\"
default.\r\n\r\n<img width=\"814\" alt=\"Screenshot 2023-09-29 at 13 05
14\"\r\nsrc=\"https://github.com/elastic/kibana/assets/34506779/bf49a974-650a-44cc-827b-b3dc834d6cee\">\r\n\r\nCo-authored-by:
Marco Antonio Ghiani
<marcoantonio.ghiani@elastic.co>","sha":"a69957e0fc821b9644a70df2a57ccb672fd71001"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.11.0","labelRegex":"^v8.11.0$","isSourceBranch":true,"state":"MERGED","url":"#167628
Monitoring] Convert node roles into array (#167628)\n\n## 📓
Summary\r\n\r\nWhen the `elasticsearch.node.roles` property is set to a
single role,\r\nthe API returns a single string instead of a list,
failing when\r\ncomputing the role list client side and resulting in an
empty list.\r\n\r\nThis fix is to parse the node roles into a list if
the API returns a\r\nsingle role string and correctly displays the
roles.\r\n\r\nE.g. Assuming we have the following roles
configuration\r\n```\r\n[\r\n {\r\n \"_source\": {\r\n
\"elasticsearch\": {\r\n \"node\": {\r\n \"roles\": [\r\n \"data\",\r\n
\"master\"\r\n ]\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"_source\": {\r\n
\"elasticsearch\": {\r\n \"node\": {\r\n \"roles\": \"master\"\r\n }\r\n
}\r\n }\r\n }\r\n ]\r\n\r\n```\r\n\r\nIt would fail at parsing the
second node roles and fall back into the\r\n\"coordinating only\"
default.\r\n\r\n<img width=\"814\" alt=\"Screenshot 2023-09-29 at 13 05
14\"\r\nsrc=\"https://github.com/elastic/kibana/assets/34506779/bf49a974-650a-44cc-827b-b3dc834d6cee\">\r\n\r\nCo-authored-by:
Marco Antonio Ghiani
<marcoantonio.ghiani@elastic.co>","sha":"a69957e0fc821b9644a70df2a57ccb672fd71001"}}]}]
BACKPORT-->

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to the previous minor version (i.e. one version back from main) release_note:fix Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.10.3 v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants