HDDS-1710. Publish JVM metrics via Hadoop metrics
Signed-off-by: Anu Engineer <aengineer@apache.org>
This commit is contained in:
parent
d59f2711e0
commit
c533b79c32
@ -42,9 +42,13 @@
|
||||
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
|
||||
import org.apache.hadoop.hdds.protocol.SCMSecurityProtocol;
|
||||
import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolPB;
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.ipc.Client;
|
||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.metrics2.MetricsSystem;
|
||||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
||||
import org.apache.hadoop.metrics2.util.MBeans;
|
||||
import org.apache.hadoop.net.DNS;
|
||||
import org.apache.hadoop.net.NetUtils;
|
||||
@ -475,4 +479,18 @@ public static InetSocketAddress getScmAddressForSecurityProtocol(
|
||||
.orElse(ScmConfigKeys.OZONE_SCM_SECURITY_SERVICE_PORT_DEFAULT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize hadoop metrics systen for Ozone servers.
|
||||
* @param configuration OzoneConfiguration to use.
|
||||
* @param serverName The logical name of the server components. (eg.
|
||||
* @return
|
||||
*/
|
||||
public static MetricsSystem initializeMetrics(OzoneConfiguration configuration,
|
||||
String serverName) {
|
||||
MetricsSystem metricsSystem = DefaultMetricsSystem.initialize(serverName);
|
||||
JvmMetrics.create(serverName,
|
||||
configuration.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY),
|
||||
DefaultMetricsSystem.instance());
|
||||
return metricsSystem;
|
||||
}
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ public void start(OzoneConfiguration configuration) {
|
||||
}
|
||||
|
||||
public void start() {
|
||||
DefaultMetricsSystem.initialize("HddsDatanode");
|
||||
OzoneConfiguration.activate();
|
||||
HddsUtils.initializeMetrics(conf, "HddsDatanode");
|
||||
if (HddsUtils.isHddsEnabled(conf)) {
|
||||
try {
|
||||
String hostname = HddsUtils.getHostName(conf);
|
||||
|
@ -81,11 +81,13 @@
|
||||
import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
|
||||
import org.apache.hadoop.hdds.server.events.EventPublisher;
|
||||
import org.apache.hadoop.hdds.server.events.EventQueue;
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.hdfs.DFSUtil;
|
||||
import org.apache.hadoop.io.IOUtils;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.metrics2.MetricsSystem;
|
||||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
||||
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
||||
import org.apache.hadoop.metrics2.util.MBeans;
|
||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||
import org.apache.hadoop.ozone.OzoneSecurityUtil;
|
||||
@ -760,7 +762,8 @@ public void start() throws IOException {
|
||||
buildRpcServerStartMessage(
|
||||
"StorageContainerLocationProtocol RPC server",
|
||||
getClientRpcAddress()));
|
||||
ms = DefaultMetricsSystem.initialize("StorageContainerManager");
|
||||
|
||||
ms = HddsUtils.initializeMetrics(configuration, "StorageContainerManager");
|
||||
|
||||
commandWatcherLeaseManager.start();
|
||||
getClientProtocolServer().start();
|
||||
|
@ -65,6 +65,7 @@
|
||||
import org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest;
|
||||
import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
|
||||
import org.apache.hadoop.hdds.tracing.TracingUtil;
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.hdfs.DFSUtil;
|
||||
import org.apache.hadoop.hdfs.util.PersistentLongFile;
|
||||
import org.apache.hadoop.io.Text;
|
||||
@ -73,6 +74,7 @@
|
||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||
import org.apache.hadoop.ipc.RPC;
|
||||
import org.apache.hadoop.ipc.Server;
|
||||
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
||||
import org.apache.hadoop.ozone.OzoneAcl;
|
||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||
import org.apache.hadoop.ozone.OzoneIllegalArgumentException;
|
||||
@ -1307,7 +1309,7 @@ public void restart() throws IOException {
|
||||
LOG.info(buildRpcServerStartMessage("OzoneManager RPC server",
|
||||
omRpcAddress));
|
||||
|
||||
DefaultMetricsSystem.initialize("OzoneManager");
|
||||
HddsUtils.initializeMetrics(configuration, "OzoneManager");
|
||||
|
||||
metadataManager.start(configuration);
|
||||
startSecretManagerIfNecessary();
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.hdds.HddsUtils;
|
||||
import org.apache.hadoop.hdds.cli.GenericCli;
|
||||
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
|
||||
import org.apache.hadoop.hdds.tracing.TracingUtil;
|
||||
@ -49,6 +50,7 @@ public class Freon extends GenericCli {
|
||||
|
||||
@Override
|
||||
public void execute(String[] argv) {
|
||||
HddsUtils.initializeMetrics(createOzoneConfiguration(), "ozone-freon");
|
||||
TracingUtil.initTracing("freon");
|
||||
super.execute(argv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user