HBASE-18678

This commit is contained in:
anwebanSalesforce 2022-06-16 12:23:02 +05:30
parent b365748485
commit 93e85f8a83
No known key found for this signature in database
GPG Key ID: EBD6837F83153BA2
5 changed files with 61 additions and 2 deletions

View File

@ -51,4 +51,15 @@ public interface MetricsMasterProcSource extends BaseSource {
String NUM_MASTER_WALS_DESC = "Number of master WAL files";
String NUM_COMPLETED_PROCS_NAME = "numCompletedProcs";
String NUM_COMPLETED_PROCS_DESC = "Number of Completed Procedures";
String NUM_ACTIVE_PROCS_NAME = "numActiveProcs";
String NUM_ACTIVE_PROCS_DESC = "Number of Active Procedures";
String LATEST_PROC_ID_NAME = "latestProcId";
String LATEST_PROC_ID_DESC = "Latest Procedure Id";
}

View File

@ -56,6 +56,18 @@ public class MetricsMasterProcSourceImpl extends BaseSourceImpl implements Metri
if (masterWrapper != null) {
metricsRecordBuilder.addGauge(Interns.info(NUM_MASTER_WALS_NAME, NUM_MASTER_WALS_DESC),
masterWrapper.getNumWALFiles());
metricsRecordBuilder
.addGauge(Interns.info(NUM_COMPLETED_PROCS_NAME, NUM_COMPLETED_PROCS_DESC),
masterWrapper.getNumberOfCompletedProcs());
metricsRecordBuilder
.addGauge(Interns.info(NUM_ACTIVE_PROCS_NAME, NUM_ACTIVE_PROCS_DESC),
masterWrapper.getNumberOfActiveProcs());
metricsRecordBuilder
.addGauge(Interns.info(LATEST_PROC_ID_NAME, LATEST_PROC_ID_DESC),
masterWrapper.getLatestProcId());
}
metricsRegistry.snapshot(metricsRecordBuilder, all);

View File

@ -153,4 +153,21 @@ public interface MetricsMasterWrapper {
* @return pair of count for online regions and offline regions
*/
PairOfSameType<Integer> getRegionCounts();
/**
* Get the number of completed procedures
*/
long getNumberOfCompletedProcs();
/**
* Get the number of active procedures
*/
long getNumberOfActiveProcs();
/**
* Get latest proc Id
*/
long getLatestProcId();
}

View File

@ -1316,7 +1316,7 @@ public class ProcedureExecutor<TEnvironment> {
return procId;
}
protected long getLastProcId() {
public long getLastProcId() {
return lastProcId.get();
}
@ -1922,7 +1922,7 @@ public class ProcedureExecutor<TEnvironment> {
return scheduler;
}
int getCompletedSize() {
public int getCompletedSize() {
return completed.size();
}

View File

@ -29,6 +29,7 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
import org.apache.hadoop.hbase.quotas.QuotaObserverChore;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot;
import org.apache.hadoop.hbase.util.PairOfSameType;
@ -211,6 +212,24 @@ public class MetricsMasterWrapperImpl implements MetricsMasterWrapper {
return convertedData;
}
@Override
public long getNumberOfCompletedProcs(){
ProcedureExecutor procedureExecutor = master.getMasterProcedureExecutor();
return procedureExecutor.getCompletedSize();
}
@Override
public long getNumberOfActiveProcs(){
ProcedureExecutor procedureExecutor = master.getMasterProcedureExecutor();
return procedureExecutor.getActiveExecutorCount();
}
@Override
public long getLatestProcId(){
ProcedureExecutor procedureExecutor = master.getMasterProcedureExecutor();
return procedureExecutor.getLastProcId();
}
Entry<Long, Long> convertSnapshot(SpaceQuotaSnapshot snapshot) {
return new SimpleImmutableEntry<Long, Long>(snapshot.getUsage(), snapshot.getLimit());
}