Skip to content

Commit

Permalink
HDDS-11563. Display OM/SCM service ID as Namespace in web UI (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aierate authored Nov 5, 2024
1 parent 0fb5e50 commit 67e5261
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
import org.apache.hadoop.hdds.protocol.SecretKeyProtocol;
import org.apache.hadoop.hdds.protocolPB.SCMSecurityProtocolClientSideTranslatorPB;
import org.apache.hadoop.hdds.scm.ha.SCMHAUtils;
import org.apache.hadoop.hdds.security.SecurityConfig;
import org.apache.hadoop.hdds.security.symmetric.DefaultSecretKeyClient;
import org.apache.hadoop.hdds.security.symmetric.SecretKeyClient;
Expand Down Expand Up @@ -116,8 +117,7 @@ public class HddsDatanodeService extends GenericCli implements ServicePlugin {
private final Map<String, RatisDropwizardExports> ratisMetricsMap =
new ConcurrentHashMap<>();
private List<RatisDropwizardExports.MetricReporter> ratisReporterList = null;
private DNMXBeanImpl serviceRuntimeInfo =
new DNMXBeanImpl(HddsVersionInfo.HDDS_VERSION_INFO) { };
private DNMXBeanImpl serviceRuntimeInfo;
private ObjectName dnInfoBeanName;
private HddsDatanodeClientProtocolServer clientProtocolServer;
private OzoneAdmins admins;
Expand Down Expand Up @@ -210,6 +210,12 @@ public void start(OzoneConfiguration configuration) {
}

public void start() {
serviceRuntimeInfo = new DNMXBeanImpl(HddsVersionInfo.HDDS_VERSION_INFO) {
@Override
public String getNamespace() {
return SCMHAUtils.getScmServiceId(conf);
}
};
serviceRuntimeInfo.setStartTime();

ratisReporterList = RatisDropwizardExports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
*/
public interface ServiceRuntimeInfo {

/**
* Gets the namespace of Ozone.
*
* @return the namespace
*/
default String getNamespace() {
return "";
};

/**
* Gets the version of Hadoop.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<h1>Overview</h1>
<table class="table table-bordered table-striped">
<tbody>
<tr ng-if="$ctrl.jmx.Namespace && $ctrl.jmx.Namespace !== ''">
<th>Namespace:</th>
<td>{{$ctrl.jmx.Namespace}}</td>
</tr>
<tr>
<th>Started:</th>
<td>{{$ctrl.jmx.StartedTimeInMillis | date : 'medium'}}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2063,6 +2063,10 @@ public StatefulServiceStateManager getStatefulServiceStateManager() {
return statefulServiceStateManager;
}

@Override
public String getNamespace() {
return scmHANodeDetails.getLocalNodeDetails().getServiceId();
}
/**
* Get the safe mode status of all rules.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3057,6 +3057,11 @@ private void unregisterMXBean() {
}
}

@Override
public String getNamespace() {
return omNodeDetails.getServiceId();
}

@Override
public String getRpcPort() {
return "" + omRpcAddress.getPort();
Expand Down

0 comments on commit 67e5261

Please sign in to comment.