8000 Add cluster topology HTTP API endpoint by SergeTupchiy · Pull Request #11251 · emqx/emqx · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@SergeTupchiy
Copy link
Contributor
@SergeTupchiy SergeTupchiy commented Jul 11, 2023

Fixes EMQX-10392

Summary

🤖 Generated by Copilot at 10314a5

This pull request adds a new API for cluster topology that returns the core and replicant nodes in the EMQ X cluster. It also updates the version numbers and the signing script for the enterprise edition. It implements the new API using the emqx_bpapi behaviour and adds a common test suite for it. It adds the i18n messages for the new API and registers it in the bpapi.versions file.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Changed lines covered in coverage report
  • Change log has been added to changes/(ce|ee)/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

@SergeTupchiy SergeTupchiy requested review from a team, Rory-Z, lafirest and sstrigler as code owners July 11, 2023 11:17
@SergeTupchiy SergeTupchiy changed the base branch from master to release-51 July 11, 2023 11:18
@SergeTupchiy SergeTupchiy force-pushed the EMQX-10392-cluster-topology-api branch 2 times, most recently from 940eb4e to 7784768 Compare July 11, 2023 11:25
@SergeTupchiy
Copy link
Contributor Author

Usage example:

curl -s --basic -u `cat data/bootstrap_user` 'localhost:18083/api/v5/cluster/topology' | jq
[
  {
    "core_node": "emqx@emqx-core-1.emqx-headless.default.svc.cluster.local",
    "replicant_nodes": [
      {
        "node": "emqx@10.244.0.190",
        "streams": 3
      },
      {
        "node": "emqx@10.244.0.189",
        "streams": 4
      },
      {
        "node": "emqx@10.244.0.188",
        "streams": 13
      },
      {
        "node": "emqx@10.244.0.187",
        "streams": 10
      }
    ]
  },
  {
    "core_node": "emqx@emqx-core-0.emqx-headless.default.svc.cluster.local",
    "replicant_nodes": [
      {
        "node": "emqx@10.244.0.190",
        "streams": 10
      },
      {
        "node": "emqx@10.244.0.189",
        "streams": 9
      },
      {
        "node": "emqx@10.244.0.187",
        "streams": 3
      },
      {
        "node": "emqx@10.244.0.185",
        "streams": 13
      }
    ]
  }
]

keynslug
keynslug previously approved these changes Jul 11, 2023
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a bit more future-proof to respond with whole mria_status:agents() here? 🤔 And do the aggregation in the API handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thanks.
Fixed.

@SergeTupchiy SergeTupchiy force-pushed the EMQX-10392-cluster-topology-api branch 2 times, most recently from 0dade0a to b1df3cd Compare July 11, 2023 13:22
@SergeTupchiy SergeTupchiy requested a review from keynslug July 11, 2023 13:23
The endpoint shows Mria RLOG cluster topology info:
connections between core and replicant nodes.

Closes: EMQX-10392
@SergeTupchiy SergeTupchiy force-pushed the EMQX-10392-cluster-topology-api branch from b1df3cd to 19de10b Compare July 11, 2023 13:25
@SergeTupchiy SergeTupchiy merged commit fce3060 into emqx:release-51 Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0