HBASE-20672 New metrics ReadRequestRate and WriteRequestRate
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
cf1f63bf91
commit
37e5f5fb5f
|
@ -256,12 +256,18 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
|
|||
String READ_REQUEST_COUNT = "readRequestCount";
|
||||
String READ_REQUEST_COUNT_DESC =
|
||||
"Number of read requests with non-empty Results that this RegionServer has answered.";
|
||||
String READ_REQUEST_RATE_PER_SECOND = "readRequestRatePerSecond";
|
||||
String READ_REQUEST_RATE_DESC =
|
||||
"Rate of answering the read requests by this region server per second.";
|
||||
String FILTERED_READ_REQUEST_COUNT = "filteredReadRequestCount";
|
||||
String FILTERED_READ_REQUEST_COUNT_DESC =
|
||||
"Number of filtered read requests this RegionServer has answered.";
|
||||
String WRITE_REQUEST_COUNT = "writeRequestCount";
|
||||
String WRITE_REQUEST_COUNT_DESC =
|
||||
"Number of mutation requests this RegionServer has answered.";
|
||||
String WRITE_REQUEST_RATE_PER_SECOND = "writeRequestRatePerSecond";
|
||||
String WRITE_REQUEST_RATE_DESC =
|
||||
"Rate of answering the mutation requests by this region server per second.";
|
||||
String CHECK_MUTATE_FAILED_COUNT = "checkMutateFailedCount";
|
||||
String CHECK_MUTATE_FAILED_COUNT_DESC =
|
||||
"Number of Check and Mutate calls that failed the checks.";
|
||||
|
|
|
@ -135,6 +135,11 @@ public interface MetricsRegionServerWrapper {
|
|||
*/
|
||||
long getReadRequestsCount();
|
||||
|
||||
/**
|
||||
* Get the rate of read requests per second to regions hosted on this region server.
|
||||
*/
|
||||
double getReadRequestsRatePerSecond();
|
||||
|
||||
/**
|
||||
* Get the number of filtered read requests to regions hosted on this region server.
|
||||
*/
|
||||
|
@ -145,6 +150,11 @@ public interface MetricsRegionServerWrapper {
|
|||
*/
|
||||
long getWriteRequestsCount();
|
||||
|
||||
/**
|
||||
* Get the rate of write requests per second to regions hosted on this region server.
|
||||
*/
|
||||
double getWriteRequestsRatePerSecond();
|
||||
|
||||
/**
|
||||
* Get the number of CAS operations that failed.
|
||||
*/
|
||||
|
|
|
@ -544,7 +544,11 @@ public class MetricsRegionServerSourceImpl
|
|||
.addGauge(Interns.info(MOB_FILE_CACHE_COUNT, MOB_FILE_CACHE_COUNT_DESC),
|
||||
rsWrap.getMobFileCacheCount())
|
||||
.addGauge(Interns.info(MOB_FILE_CACHE_HIT_PERCENT, MOB_FILE_CACHE_HIT_PERCENT_DESC),
|
||||
rsWrap.getMobFileCacheHitPercent());
|
||||
rsWrap.getMobFileCacheHitPercent())
|
||||
.addGauge(Interns.info(READ_REQUEST_RATE_PER_SECOND, READ_REQUEST_RATE_DESC),
|
||||
rsWrap.getReadRequestsRatePerSecond())
|
||||
.addGauge(Interns.info(WRITE_REQUEST_RATE_PER_SECOND, WRITE_REQUEST_RATE_DESC),
|
||||
rsWrap.getWriteRequestsRatePerSecond());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -74,8 +74,10 @@ class MetricsRegionServerWrapperImpl
|
|||
private volatile long numReferenceFiles = 0;
|
||||
private volatile double requestsPerSecond = 0.0;
|
||||
private volatile long readRequestsCount = 0;
|
||||
private volatile double readRequestsRatePerSecond = 0;
|
||||
private volatile long filteredReadRequestsCount = 0;
|
||||
private volatile long writeRequestsCount = 0;
|
||||
private volatile double writeRequestsRatePerSecond = 0;
|
||||
private volatile long checkAndMutateChecksFailed = 0;
|
||||
private volatile long checkAndMutateChecksPassed = 0;
|
||||
private volatile long storefileIndexSize = 0;
|
||||
|
@ -518,6 +520,11 @@ class MetricsRegionServerWrapperImpl
|
|||
return readRequestsCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getReadRequestsRatePerSecond() {
|
||||
return readRequestsRatePerSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFilteredReadRequestsCount() {
|
||||
return filteredReadRequestsCount;
|
||||
|
@ -528,6 +535,11 @@ class MetricsRegionServerWrapperImpl
|
|||
return writeRequestsCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWriteRequestsRatePerSecond() {
|
||||
return writeRequestsRatePerSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcGetRequestsCount() {
|
||||
return regionServer.rpcServices.rpcGetRequestCount.sum();
|
||||
|
@ -710,6 +722,8 @@ class MetricsRegionServerWrapperImpl
|
|||
|
||||
private long lastRan = 0;
|
||||
private long lastRequestCount = 0;
|
||||
private long lastReadRequestsCount = 0;
|
||||
private long lastWriteRequestsCount = 0;
|
||||
|
||||
@Override
|
||||
synchronized public void run() {
|
||||
|
@ -845,6 +859,21 @@ class MetricsRegionServerWrapperImpl
|
|||
requestsPerSecond = (currentRequestCount - lastRequestCount) /
|
||||
((currentTime - lastRan) / 1000.0);
|
||||
lastRequestCount = currentRequestCount;
|
||||
|
||||
long intervalReadRequestsCount = tempReadRequestsCount - lastReadRequestsCount;
|
||||
long intervalWriteRequestsCount = tempWriteRequestsCount - lastWriteRequestsCount;
|
||||
|
||||
double readRequestsRatePerMilliSecond = ((double)intervalReadRequestsCount/
|
||||
(double)period);
|
||||
double writeRequestsRatePerMilliSecond = ((double)intervalWriteRequestsCount/
|
||||
(double)period);
|
||||
|
||||
readRequestsRatePerSecond = readRequestsRatePerMilliSecond * 1000.0;
|
||||
writeRequestsRatePerSecond = writeRequestsRatePerMilliSecond * 1000.0;
|
||||
|
||||
lastReadRequestsCount = tempReadRequestsCount;
|
||||
lastWriteRequestsCount = tempWriteRequestsCount;
|
||||
|
||||
}
|
||||
lastRan = currentTime;
|
||||
|
||||
|
|
|
@ -100,6 +100,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
|
|||
return 899;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getReadRequestsRatePerSecond() {
|
||||
return 10.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalRowActionRequestCount() {
|
||||
return getReadRequestsCount() + getWriteRequestsCount();
|
||||
|
@ -120,6 +125,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
|
|||
return 707;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWriteRequestsRatePerSecond() {
|
||||
return 10.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRpcGetRequestsCount() {
|
||||
return 521;
|
||||
|
|
Loading…
Reference in New Issue