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.conf.OzoneConfiguration;
|
||||||
import org.apache.hadoop.hdds.protocol.SCMSecurityProtocol;
|
import org.apache.hadoop.hdds.protocol.SCMSecurityProtocol;
|
||||||
import org.apache.hadoop.hdds.scm.protocolPB.ScmBlockLocationProtocolPB;
|
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.Client;
|
||||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||||
import org.apache.hadoop.ipc.RPC;
|
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.metrics2.util.MBeans;
|
||||||
import org.apache.hadoop.net.DNS;
|
import org.apache.hadoop.net.DNS;
|
||||||
import org.apache.hadoop.net.NetUtils;
|
import org.apache.hadoop.net.NetUtils;
|
||||||
@ -475,4 +479,18 @@ public static InetSocketAddress getScmAddressForSecurityProtocol(
|
|||||||
.orElse(ScmConfigKeys.OZONE_SCM_SECURITY_SERVICE_PORT_DEFAULT));
|
.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() {
|
public void start() {
|
||||||
DefaultMetricsSystem.initialize("HddsDatanode");
|
|
||||||
OzoneConfiguration.activate();
|
OzoneConfiguration.activate();
|
||||||
|
HddsUtils.initializeMetrics(conf, "HddsDatanode");
|
||||||
if (HddsUtils.isHddsEnabled(conf)) {
|
if (HddsUtils.isHddsEnabled(conf)) {
|
||||||
try {
|
try {
|
||||||
String hostname = HddsUtils.getHostName(conf);
|
String hostname = HddsUtils.getHostName(conf);
|
||||||
|
@ -81,11 +81,13 @@
|
|||||||
import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
|
import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
|
||||||
import org.apache.hadoop.hdds.server.events.EventPublisher;
|
import org.apache.hadoop.hdds.server.events.EventPublisher;
|
||||||
import org.apache.hadoop.hdds.server.events.EventQueue;
|
import org.apache.hadoop.hdds.server.events.EventQueue;
|
||||||
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||||
import org.apache.hadoop.hdfs.DFSUtil;
|
import org.apache.hadoop.hdfs.DFSUtil;
|
||||||
import org.apache.hadoop.io.IOUtils;
|
import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.ipc.RPC;
|
import org.apache.hadoop.ipc.RPC;
|
||||||
import org.apache.hadoop.metrics2.MetricsSystem;
|
import org.apache.hadoop.metrics2.MetricsSystem;
|
||||||
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
|
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.metrics2.util.MBeans;
|
||||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||||
import org.apache.hadoop.ozone.OzoneSecurityUtil;
|
import org.apache.hadoop.ozone.OzoneSecurityUtil;
|
||||||
@ -760,7 +762,8 @@ public void start() throws IOException {
|
|||||||
buildRpcServerStartMessage(
|
buildRpcServerStartMessage(
|
||||||
"StorageContainerLocationProtocol RPC server",
|
"StorageContainerLocationProtocol RPC server",
|
||||||
getClientRpcAddress()));
|
getClientRpcAddress()));
|
||||||
ms = DefaultMetricsSystem.initialize("StorageContainerManager");
|
|
||||||
|
ms = HddsUtils.initializeMetrics(configuration, "StorageContainerManager");
|
||||||
|
|
||||||
commandWatcherLeaseManager.start();
|
commandWatcherLeaseManager.start();
|
||||||
getClientProtocolServer().start();
|
getClientProtocolServer().start();
|
||||||
|
@ -65,6 +65,7 @@
|
|||||||
import org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest;
|
import org.apache.hadoop.hdds.security.x509.certificates.utils.CertificateSignRequest;
|
||||||
import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
|
import org.apache.hadoop.hdds.server.ServiceRuntimeInfoImpl;
|
||||||
import org.apache.hadoop.hdds.tracing.TracingUtil;
|
import org.apache.hadoop.hdds.tracing.TracingUtil;
|
||||||
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||||
import org.apache.hadoop.hdfs.DFSUtil;
|
import org.apache.hadoop.hdfs.DFSUtil;
|
||||||
import org.apache.hadoop.hdfs.util.PersistentLongFile;
|
import org.apache.hadoop.hdfs.util.PersistentLongFile;
|
||||||
import org.apache.hadoop.io.Text;
|
import org.apache.hadoop.io.Text;
|
||||||
@ -73,6 +74,7 @@
|
|||||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||||
import org.apache.hadoop.ipc.RPC;
|
import org.apache.hadoop.ipc.RPC;
|
||||||
import org.apache.hadoop.ipc.Server;
|
import org.apache.hadoop.ipc.Server;
|
||||||
|
import org.apache.hadoop.metrics2.source.JvmMetrics;
|
||||||
import org.apache.hadoop.ozone.OzoneAcl;
|
import org.apache.hadoop.ozone.OzoneAcl;
|
||||||
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
import org.apache.hadoop.ozone.OzoneConfigKeys;
|
||||||
import org.apache.hadoop.ozone.OzoneIllegalArgumentException;
|
import org.apache.hadoop.ozone.OzoneIllegalArgumentException;
|
||||||
@ -1307,7 +1309,7 @@ public void restart() throws IOException {
|
|||||||
LOG.info(buildRpcServerStartMessage("OzoneManager RPC server",
|
LOG.info(buildRpcServerStartMessage("OzoneManager RPC server",
|
||||||
omRpcAddress));
|
omRpcAddress));
|
||||||
|
|
||||||
DefaultMetricsSystem.initialize("OzoneManager");
|
HddsUtils.initializeMetrics(configuration, "OzoneManager");
|
||||||
|
|
||||||
metadataManager.start(configuration);
|
metadataManager.start(configuration);
|
||||||
startSecretManagerIfNecessary();
|
startSecretManagerIfNecessary();
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hdds.HddsUtils;
|
||||||
import org.apache.hadoop.hdds.cli.GenericCli;
|
import org.apache.hadoop.hdds.cli.GenericCli;
|
||||||
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
|
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
|
||||||
import org.apache.hadoop.hdds.tracing.TracingUtil;
|
import org.apache.hadoop.hdds.tracing.TracingUtil;
|
||||||
@ -49,6 +50,7 @@ public class Freon extends GenericCli {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(String[] argv) {
|
public void execute(String[] argv) {
|
||||||
|
HddsUtils.initializeMetrics(createOzoneConfiguration(), "ozone-freon");
|
||||||
TracingUtil.initTracing("freon");
|
TracingUtil.initTracing("freon");
|
||||||
super.execute(argv);
|
super.execute(argv);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user