Skip to content

Commit

Permalink
Support display master system status from master ui
Browse files Browse the repository at this point in the history
### What changes are proposed in this pull request?
This pr support display master system status in master's web ui. as
below.
<img width="674" alt="Snipaste_2023-01-17_10-30-54"
src="https://user-images.githubusercontent.com/39544641/212797561-31608c69-f3a7-4fbf-b4cb-b9953f578cbe.png">


### Why are the changes needed?
Sometimes, we want to know cluster info from web ui, and system status
is important to check if master is healthy. so it's more convenient for
users to know master health status on web ui.

### Does this PR introduce any user facing changes?
no

pr-link: #16779
change-id: cid-138f10111eaa5bfa6b13a7919051f510b94d74fd
  • Loading branch information
wenfang6 committed Feb 28, 2023
1 parent 02bc22c commit fb9e88d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions core/common/src/main/java/alluxio/wire/MasterWebUIOverview.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public final class MasterWebUIOverview implements Serializable {
private String mRevision;
private String mMasterRole;
private String mLeaderId;
private String mSystemStatus;

/**
* Creates a new instance of {@link MasterWebUIOverview}.
Expand Down Expand Up @@ -302,6 +303,15 @@ public String getLeaderId() {
return mLeaderId;
}

/**
* Gets system status.
*
* @return the system status
*/
public String getSystemStatus() {
return mSystemStatus;
}

/**
* Sets capacity.
*
Expand Down Expand Up @@ -598,6 +608,17 @@ public MasterWebUIOverview setLeaderId(String leaderId) {
return this;
}

/**
* Sets the system status.
*
* @param systemStatus the system status
* @return the master status system
*/
public MasterWebUIOverview setSystemStatus(String systemStatus) {
mSystemStatus = systemStatus;
return this;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("capacity", mCapacity)
Expand All @@ -616,6 +637,7 @@ public String toString() {
.add("uptime", mUptime).add("usedCapacity", mUsedCapacity)
.add("version", mVersion).add("revision", mRevision)
.add("leaderId", mLeaderId)
.add("systemStatus", mSystemStatus)
.add("masterRole", mMasterRole)
.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import alluxio.master.file.FileSystemMaster;
import alluxio.master.file.contexts.ListStatusContext;
import alluxio.master.file.meta.MountTable;
import alluxio.master.throttle.SystemMonitor.SystemStatus;
import alluxio.metrics.MetricKey;
import alluxio.metrics.MetricsSystem;
import alluxio.security.authentication.AuthenticatedClientUser;
Expand Down Expand Up @@ -373,6 +374,14 @@ public Response getWebUIOverview() {
if (leaderIdGauge != null) {
response.setLeaderId((String) leaderIdGauge.getValue());
}
// Add master system status
Gauge systemStatusGauge = MetricsSystem.METRIC_REGISTRY.getGauges()
.get("Master.system.status");
if (systemStatusGauge != null) {
SystemStatus systemStatus = (SystemStatus) systemStatusGauge.getValue();
response.setSystemStatus(systemStatus.toString());
}

return response;
}, Configuration.global());
}
Expand Down
4 changes: 4 additions & 0 deletions webui/master/src/containers/pages/Overview/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export class OverviewPresenter extends React.Component<AllProps> {
<th scope="row">LeaderId</th>
<td>{data.leaderId}</td>
</tr>
<tr>
<th scope="row">System Status</th>
<td>{data.systemStatus}</td>
</tr>
{this.renderConfigurationIssues(data.configCheckErrors, 'text-error')}
{this.renderConfigurationIssues(data.configCheckWarns, 'text-warning')}
{this.renderJournalDiskWarnings(data.journalDiskWarnings, 'text-warning')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ exports[`Overview Shallow component Matches snapshot 1`] = `
</th>
<td />
</tr>
<tr>
<th
scope="row"
>
System Status
</th>
<td />
</tr>
</tbody>
</Table>
</div>
Expand Down
1 change: 1 addition & 0 deletions webui/master/src/store/overview/reducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const initialOverviewState: IOverviewState = {
journalCheckpointTimeWarning: '',
journalDiskWarnings: [],
leaderId: '',
systemStatus: '',
liveWorkerNodes: 0,
masterNodeAddress: '',
replicaBlockCount: '',
Expand Down
1 change: 1 addition & 0 deletions webui/master/src/store/overview/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface IOverview {
journalCheckpointTimeWarning: string;
journalDiskWarnings: string[];
leaderId: string;
systemStatus: string;
liveWorkerNodes: number;
masterNodeAddress: string;
replicaBlockCount: string;
Expand Down

0 comments on commit fb9e88d

Please sign in to comment.