|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.regionserver.metrics.SchemaMetrics
public class SchemaMetrics
A collection of metric names in a given column family or a (table, column family) combination. The following "dimensions" are supported:
An instance of this class does not store any metric values. It just allows to determine the correct metric name for each combination of the above dimensions.
Metric key | Per-table metrics conf setting | Description | |
---|---|---|---|
On | Off | ||
tbl.T.cf.CF.M | Include | Skip | A specific column family of a specific table |
tbl.T.M | Skip | Skip | All column families in the given table |
cf.CF.M | Skip | Include | A specific column family in all tables |
M | Include | Include | All column families in all tables |
Nested Class Summary | |
---|---|
static class |
SchemaMetrics.BlockMetricType
|
static interface |
SchemaMetrics.SchemaAware
|
static class |
SchemaMetrics.StoreMetricType
|
Field Summary | |
---|---|
static SchemaMetrics |
ALL_SCHEMA_METRICS
Metrics for all tables and column families. |
static String |
BLOCK_TYPE_PREFIX
|
static String |
CF_BAD_FAMILY_PREFIX
|
static String |
CF_PREFIX
|
static String |
CF_UNKNOWN_PREFIX
|
static String |
METRIC_GETSIZE
|
static String |
METRIC_NEXTSIZE
|
static boolean |
NO_COMPACTION
Use for readability when obtaining non-compaction counters |
static String |
REGION_PREFIX
|
static String |
TABLE_PREFIX
|
static String |
TOTAL_KEY
A special schema metric value that means "all tables aggregated" or "all column families aggregated" when used as a table name or a column family name. |
static String |
UNKNOWN
A string used when column family or table name is unknown, and in some unit tests. |
Method Summary | |
---|---|
void |
accumulateStoreMetric(Map<String,org.apache.commons.lang.mutable.MutableDouble> tmpMap,
SchemaMetrics.StoreMetricType storeMetricType,
double val)
Used to accumulate store metrics across multiple regions in a region server. |
void |
addToCacheSize(BlockType.BlockCategory category,
long cacheSizeDelta)
Adds the given delta to the cache size for the given block category and the aggregate metric for all block categories. |
static void |
configureGlobally(org.apache.hadoop.conf.Configuration conf)
Sets the flag whether to use table name in metric names according to the given configuration. |
static Map<String,Long> |
diffMetrics(Map<String,Long> a,
Map<String,Long> b)
|
void |
flushMetrics()
Notify the SchemaMetrics to flush all of the the metrics |
static String |
formatMetrics(Map<String,Long> metrics)
Formats the given map of metrics in a human-readable way. |
static String |
generateSchemaMetricsPrefix(byte[] tableName,
byte[] cfName)
|
static String |
generateSchemaMetricsPrefix(String tableName,
Set<byte[]> families)
Method to transform a set of column families in byte[] format with table name into a metric key prefix. |
static String |
generateSchemaMetricsPrefix(String tableName,
String cfName)
Method to transform a combination of a table name and a column family name into a metric key prefix. |
String |
getBlockMetricName(BlockType.BlockCategory blockCategory,
boolean isCompaction,
SchemaMetrics.BlockMetricType metricType)
|
String |
getBloomMetricName(boolean isInBloom)
|
static SchemaMetrics |
getInstance(String tableName,
String cfName)
Returns a SchemaMetrics object for the given table and column
family, instantiating it if necessary. |
static long |
getLong(Map<String,Long> m,
String k)
|
static Map<String,Long> |
getMetricsSnapshot()
|
String |
getStoreMetricName(SchemaMetrics.StoreMetricType storeMetricType)
|
String |
getStoreMetricNameMax(SchemaMetrics.StoreMetricType storeMetricType)
|
static SchemaMetrics |
getUnknownInstanceForTest()
Creates an instance pretending both the table and column family are unknown. |
static void |
setUseTableNameInTest(boolean useTableNameNew)
Set the flag to use or not use table name in metric names. |
void |
updateBloomMetrics(boolean isInBloom)
Increments both the per-CF and the aggregate counter of bloom positives/negatives as specified by the argument. |
void |
updateOnCacheHit(BlockType.BlockCategory blockCategory,
boolean isCompaction)
Updates the number of hits and the total number of block reads on a block cache hit. |
void |
updateOnCacheHit(BlockType.BlockCategory blockCategory,
boolean isCompaction,
long count)
Updates the number of hits and the total number of block reads on a block cache hit. |
void |
updateOnCacheMiss(BlockType.BlockCategory blockCategory,
boolean isCompaction,
long timeMs)
Updates read time, the number of misses, and the total number of block reads on a block cache miss. |
void |
updateOnCachePutOrEvict(BlockType.BlockCategory blockCategory,
long cacheSizeDelta,
boolean isEviction)
|
void |
updatePersistentStoreMetric(SchemaMetrics.StoreMetricType storeMetricType,
long value)
Update a metric that does not get reset on every poll. |
static void |
validateMetricChanges(Map<String,Long> oldMetrics)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String UNKNOWN
public static final String TABLE_PREFIX
public static final String CF_PREFIX
public static final String BLOCK_TYPE_PREFIX
public static final String REGION_PREFIX
public static final String CF_UNKNOWN_PREFIX
public static final String CF_BAD_FAMILY_PREFIX
public static final boolean NO_COMPACTION
public static final String METRIC_GETSIZE
public static final String METRIC_NEXTSIZE
public static final String TOTAL_KEY
public static final SchemaMetrics ALL_SCHEMA_METRICS
Method Detail |
---|
public static SchemaMetrics getInstance(String tableName, String cfName)
SchemaMetrics
object for the given table and column
family, instantiating it if necessary.
tableName
- table name (null is interpreted as "unknown"). This is
ignoredcfName
- column family name (null is interpreted as "unknown")public String getBlockMetricName(BlockType.BlockCategory blockCategory, boolean isCompaction, SchemaMetrics.BlockMetricType metricType)
public String getBloomMetricName(boolean isInBloom)
public void accumulateStoreMetric(Map<String,org.apache.commons.lang.mutable.MutableDouble> tmpMap, SchemaMetrics.StoreMetricType storeMetricType, double val)
tmpMap
- a temporary map for accumulating store metricsstoreMetricType
- the store metric type to incrementval
- the value to add to the metricpublic String getStoreMetricName(SchemaMetrics.StoreMetricType storeMetricType)
public String getStoreMetricNameMax(SchemaMetrics.StoreMetricType storeMetricType)
public void updatePersistentStoreMetric(SchemaMetrics.StoreMetricType storeMetricType, long value)
storeMetricType
- the store metric to updatevalue
- the value to update the metric topublic void updateOnCacheHit(BlockType.BlockCategory blockCategory, boolean isCompaction)
public void updateOnCacheHit(BlockType.BlockCategory blockCategory, boolean isCompaction, long count)
public void flushMetrics()
public void updateOnCacheMiss(BlockType.BlockCategory blockCategory, boolean isCompaction, long timeMs)
public void addToCacheSize(BlockType.BlockCategory category, long cacheSizeDelta)
public void updateOnCachePutOrEvict(BlockType.BlockCategory blockCategory, long cacheSizeDelta, boolean isEviction)
public void updateBloomMetrics(boolean isInBloom)
public static void configureGlobally(org.apache.hadoop.conf.Configuration conf)
public static String generateSchemaMetricsPrefix(String tableName, String cfName)
TOTAL_KEY
are omitted from the prefix.
tableName
- the table name or TOTAL_KEY
for all tablescfName
- the column family name or TOTAL_KEY
for all CFs
public static String generateSchemaMetricsPrefix(byte[] tableName, byte[] cfName)
public static String generateSchemaMetricsPrefix(String tableName, Set<byte[]> families)
tableName
- the table name or TOTAL_KEY
for all tablesfamilies
- the ordered set of column families
public static Map<String,Long> getMetricsSnapshot()
public static long getLong(Map<String,Long> m, String k)
public static Map<String,Long> diffMetrics(Map<String,Long> a, Map<String,Long> b)
public static void validateMetricChanges(Map<String,Long> oldMetrics)
public static SchemaMetrics getUnknownInstanceForTest()
public static void setUseTableNameInTest(boolean useTableNameNew)
public static String formatMetrics(Map<String,Long> metrics)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |