Class ServerSideScanMetrics
java.lang.Object
org.apache.hadoop.hbase.client.metrics.ServerSideScanMetrics
- Direct Known Subclasses:
ScanMetrics
Provides server side metrics related to scan operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
private final Map<String,
AtomicLong> Hash to hold the String -> Atomic Long mappings for each metricfinal AtomicLong
final AtomicLong
number of rows filtered during scan RPCfinal AtomicLong
number of rows scanned during scan RPC.protected RegionScanMetricsData
static final String
final AtomicLong
private final List<RegionScanMetricsData>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToCounter
(String counterName, long delta) Increments the counter with counterName by delta, does nothing if counter does not exist.Get values grouped by each region scanned since the last time this was called.collectMetricsByRegion
(boolean reset) Get values grouped by each region scanned.protected AtomicLong
createCounter
(String counterName) Create a new counter with the specified name.getCounter
(String counterName) ReturnsAtomicLong
instance for this counter name, null if counter does not exist.Get all the values combined for all the regions since the last time this function was called.getMetricsMap
(boolean reset) Get all the values combined for all the regions.boolean
hasCounter
(String counterName) Returns true if a counter exists with the counterName.void
initScanMetricsRegionInfo
(String encodedRegionName, ServerName serverName) Call this method after callingmoveToNextRegion()
to populate server name and encoded region name details for the region being scanned and for which metrics are being collected at the moment.void
If region level scan metrics are enabled, must call this method to start collecting metrics for the region before scanning the region.void
setCounter
(String counterName, long value) Sets counter with counterName to passed in value, does nothing if counter does not exist.toString()
-
Field Details
-
counters
Hash to hold the String -> Atomic Long mappings for each metric -
regionScanMetricsData
-
currentRegionScanMetricsData
-
COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME
- See Also:
-
COUNT_OF_ROWS_FILTERED_KEY_METRIC_NAME
- See Also:
-
BLOCK_BYTES_SCANNED_KEY_METRIC_NAME
- See Also:
-
FS_READ_TIME_METRIC_NAME
- See Also:
-
countOfRowsFiltered
number of rows filtered during scan RPC -
countOfRowsScanned
number of rows scanned during scan RPC. Not every row scanned will be returned to the client since rows may be filtered. -
countOfBlockBytesScanned
-
fsReadTime
-
-
Constructor Details
-
ServerSideScanMetrics
public ServerSideScanMetrics()
-
-
Method Details
-
moveToNextRegion
If region level scan metrics are enabled, must call this method to start collecting metrics for the region before scanning the region. -
createCounter
Create a new counter with the specified name.- Returns:
AtomicLong
instance for the counter with counterName
-
setCounter
Sets counter with counterName to passed in value, does nothing if counter does not exist. If region level scan metrics are enabled then sets the value of counter for the current region being scanned. -
hasCounter
Returns true if a counter exists with the counterName. -
getCounter
ReturnsAtomicLong
instance for this counter name, null if counter does not exist. -
addToCounter
Increments the counter with counterName by delta, does nothing if counter does not exist. If region level scan metrics are enabled then increments the counter corresponding to the current region being scanned. Please seemoveToNextRegion()
. -
getMetricsMap
Get all the values combined for all the regions since the last time this function was called. Calling this function will reset all AtomicLongs in the instance back to 0.- Returns:
- A Map of String -> Long for metrics
-
getMetricsMap
Get all the values combined for all the regions. If reset is true, we will reset all the AtomicLongs back to 0.- Parameters:
reset
- whether to reset the AtomicLongs to 0.- Returns:
- A Map of String -> Long for metrics
-
collectMetricsByRegion
Get values grouped by each region scanned since the last time this was called. Calling this function will reset all region level scan metrics counters back to 0.- Returns:
- A Map of region -> (Map of metric name -> Long) for metrics
-
collectMetricsByRegion
Get values grouped by each region scanned. If reset is true, will reset all the region level scan metrics counters back to 0.- Parameters:
reset
- whether to reset region level scan metric counters to 0.- Returns:
- A Map of region -> (Map of metric name -> Long) for metrics
-
toString
-
initScanMetricsRegionInfo
Call this method after callingmoveToNextRegion()
to populate server name and encoded region name details for the region being scanned and for which metrics are being collected at the moment.
-