HBASE-18520 Add jmx value to determine true Master Start time
This is to determine how long it took in total for the master to start and finish initializing. Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
55a754e6cb
commit
0f20ec395a
|
@ -49,6 +49,7 @@ public interface MetricsMasterSource extends BaseSource {
|
||||||
// Strings used for exporting to metrics system.
|
// Strings used for exporting to metrics system.
|
||||||
String MASTER_ACTIVE_TIME_NAME = "masterActiveTime";
|
String MASTER_ACTIVE_TIME_NAME = "masterActiveTime";
|
||||||
String MASTER_START_TIME_NAME = "masterStartTime";
|
String MASTER_START_TIME_NAME = "masterStartTime";
|
||||||
|
String MASTER_FINISHED_INITIALIZATION_TIME_NAME = "masterFinishedInitializationTime";
|
||||||
String AVERAGE_LOAD_NAME = "averageLoad";
|
String AVERAGE_LOAD_NAME = "averageLoad";
|
||||||
String LIVE_REGION_SERVERS_NAME = "liveRegionServers";
|
String LIVE_REGION_SERVERS_NAME = "liveRegionServers";
|
||||||
String DEAD_REGION_SERVERS_NAME = "deadRegionServers";
|
String DEAD_REGION_SERVERS_NAME = "deadRegionServers";
|
||||||
|
@ -64,6 +65,7 @@ public interface MetricsMasterSource extends BaseSource {
|
||||||
String CLUSTER_REQUESTS_NAME = "clusterRequests";
|
String CLUSTER_REQUESTS_NAME = "clusterRequests";
|
||||||
String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
|
String MASTER_ACTIVE_TIME_DESC = "Master Active Time";
|
||||||
String MASTER_START_TIME_DESC = "Master Start Time";
|
String MASTER_START_TIME_DESC = "Master Start Time";
|
||||||
|
String MASTER_FINISHED_INITIALIZATION_TIME_DESC = "Timestamp when Master has finished initializing";
|
||||||
String AVERAGE_LOAD_DESC = "AverageLoad";
|
String AVERAGE_LOAD_DESC = "AverageLoad";
|
||||||
String LIVE_REGION_SERVERS_DESC = "Names of live RegionServers";
|
String LIVE_REGION_SERVERS_DESC = "Names of live RegionServers";
|
||||||
String NUMBER_OF_REGION_SERVERS_DESC = "Number of RegionServers";
|
String NUMBER_OF_REGION_SERVERS_DESC = "Number of RegionServers";
|
||||||
|
|
|
@ -134,4 +134,9 @@ public interface MetricsMasterWrapper {
|
||||||
* Gets the space usage and limit for each namespace.
|
* Gets the space usage and limit for each namespace.
|
||||||
*/
|
*/
|
||||||
Map<String,Entry<Long,Long>> getNamespaceSpaceUtilization();
|
Map<String,Entry<Long,Long>> getNamespaceSpaceUtilization();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the time in Millis when the master finished initializing/becoming the active master
|
||||||
|
*/
|
||||||
|
long getMasterInitializationTime();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ public class MetricsMasterSourceImpl
|
||||||
MASTER_ACTIVE_TIME_DESC), masterWrapper.getActiveTime())
|
MASTER_ACTIVE_TIME_DESC), masterWrapper.getActiveTime())
|
||||||
.addGauge(Interns.info(MASTER_START_TIME_NAME,
|
.addGauge(Interns.info(MASTER_START_TIME_NAME,
|
||||||
MASTER_START_TIME_DESC), masterWrapper.getStartTime())
|
MASTER_START_TIME_DESC), masterWrapper.getStartTime())
|
||||||
|
.addGauge(Interns.info(MASTER_FINISHED_INITIALIZATION_TIME_NAME, MASTER_FINISHED_INITIALIZATION_TIME_DESC),
|
||||||
|
masterWrapper.getMasterInitializationTime())
|
||||||
.addGauge(Interns.info(AVERAGE_LOAD_NAME, AVERAGE_LOAD_DESC),
|
.addGauge(Interns.info(AVERAGE_LOAD_NAME, AVERAGE_LOAD_DESC),
|
||||||
masterWrapper.getAverageLoad())
|
masterWrapper.getAverageLoad())
|
||||||
.tag(Interns.info(LIVE_REGION_SERVERS_NAME, LIVE_REGION_SERVERS_DESC),
|
.tag(Interns.info(LIVE_REGION_SERVERS_NAME, LIVE_REGION_SERVERS_DESC),
|
||||||
|
|
|
@ -370,6 +370,9 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
// Time stamps for when a hmaster became active
|
// Time stamps for when a hmaster became active
|
||||||
private long masterActiveTime;
|
private long masterActiveTime;
|
||||||
|
|
||||||
|
// Time stamp for when HMaster finishes becoming Active Master
|
||||||
|
private long masterFinishedInitializationTime;
|
||||||
|
|
||||||
//should we check the compression codec type at master side, default true, HBASE-6370
|
//should we check the compression codec type at master side, default true, HBASE-6370
|
||||||
private final boolean masterCheckCompression;
|
private final boolean masterCheckCompression;
|
||||||
|
|
||||||
|
@ -873,6 +876,7 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
status.markComplete("Initialization successful");
|
status.markComplete("Initialization successful");
|
||||||
LOG.info(String.format("Master has completed initialization %.3fsec",
|
LOG.info(String.format("Master has completed initialization %.3fsec",
|
||||||
(System.currentTimeMillis() - masterActiveTime) / 1000.0f));
|
(System.currentTimeMillis() - masterActiveTime) / 1000.0f));
|
||||||
|
this.masterFinishedInitializationTime = System.currentTimeMillis();
|
||||||
configurationManager.registerObserver(this.balancer);
|
configurationManager.registerObserver(this.balancer);
|
||||||
configurationManager.registerObserver(this.hfileCleaner);
|
configurationManager.registerObserver(this.hfileCleaner);
|
||||||
|
|
||||||
|
@ -2504,6 +2508,13 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
return masterActiveTime;
|
return masterActiveTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return timestamp in millis when HMaster finished becoming the active master
|
||||||
|
*/
|
||||||
|
public long getMasterFinishedInitializationTime() {
|
||||||
|
return masterFinishedInitializationTime;
|
||||||
|
}
|
||||||
|
|
||||||
public int getNumWALFiles() {
|
public int getNumWALFiles() {
|
||||||
return procedureStore != null ? procedureStore.getActiveLogs().size() : 0;
|
return procedureStore != null ? procedureStore.getActiveLogs().size() : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,11 @@ public class MetricsMasterWrapperImpl implements MetricsMasterWrapper {
|
||||||
return master.getMergePlanCount();
|
return master.getMergePlanCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getMasterInitializationTime() {
|
||||||
|
return master.getMasterFinishedInitializationTime();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getClusterId() {
|
public String getClusterId() {
|
||||||
return master.getClusterId();
|
return master.getClusterId();
|
||||||
|
|
|
@ -545,6 +545,7 @@ public class HRegionServer extends HasThread implements
|
||||||
*/
|
*/
|
||||||
public HRegionServer(Configuration conf, CoordinatedStateManager csm) throws IOException {
|
public HRegionServer(Configuration conf, CoordinatedStateManager csm) throws IOException {
|
||||||
super("RegionServer"); // thread name
|
super("RegionServer"); // thread name
|
||||||
|
this.startcode = System.currentTimeMillis();
|
||||||
this.fsOk = true;
|
this.fsOk = true;
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
// initialize netty event loop group at the very beginning as we may use it to start rpc server,
|
// initialize netty event loop group at the very beginning as we may use it to start rpc server,
|
||||||
|
@ -590,7 +591,6 @@ public class HRegionServer extends HasThread implements
|
||||||
this.stopped = false;
|
this.stopped = false;
|
||||||
|
|
||||||
rpcServices = createRpcServices();
|
rpcServices = createRpcServices();
|
||||||
this.startcode = System.currentTimeMillis();
|
|
||||||
if (this instanceof HMaster) {
|
if (this instanceof HMaster) {
|
||||||
useThisHostnameInstead = conf.get(MASTER_HOSTNAME_KEY);
|
useThisHostnameInstead = conf.get(MASTER_HOSTNAME_KEY);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue