@InterfaceAudience.Private public class MetricsConnection extends Object
MetricsRegistry
and JmxReporter
so as to not
conflict with other uses of Yammer Metrics within the client application. Instantiating
this class implicitly creates and "starts" instances of these classes; be sure to call
shutdown()
to terminate the thread pools they allocate.Modifier and Type | Class and Description |
---|---|
static class |
MetricsConnection.CallStats
A container class for collecting details about the RPC call as it percolates.
|
protected static class |
MetricsConnection.CallTracker |
private static interface |
MetricsConnection.NewMetric<T>
A lambda for dispatching to the appropriate metric factory method
|
protected static class |
MetricsConnection.RegionStats |
protected static class |
MetricsConnection.RunnerStats |
Modifier and Type | Field and Description |
---|---|
protected MetricsConnection.CallTracker |
appendTracker |
private static int |
CAPACITY
Anticipated number of metric entries
|
static String |
CLIENT_SIDE_METRICS_ENABLED_KEY
Set this key to
true to enable metrics collection of client requests. |
private static String |
CLIENT_SVC |
private static int |
CONCURRENCY_LEVEL
Anticipated number of concurrent accessor threads, from
ConnectionManager.HConnectionImplementation.getBatchPool() |
protected MetricsConnection.CallTracker |
deleteTracker |
private static String |
DRTN_BASE |
protected MetricsConnection.CallTracker |
getTracker |
private static String |
HEAP_BASE |
private MetricsConnection.NewMetric<com.yammer.metrics.core.Histogram> |
histogramFactory |
protected MetricsConnection.CallTracker |
incrementTracker |
private static float |
LOAD_FACTOR
Default load factor from
HashMap.DEFAULT_LOAD_FACTOR |
private static String |
MEMLOAD_BASE |
protected com.yammer.metrics.core.Counter |
metaCacheHits |
protected com.yammer.metrics.core.Counter |
metaCacheMisses |
protected MetricsConnection.CallTracker |
multiTracker |
protected MetricsConnection.CallTracker |
putTracker |
private com.yammer.metrics.core.MetricsRegistry |
registry |
private com.yammer.metrics.reporting.JmxReporter |
reporter |
private static String |
REQ_BASE |
private static String |
RESP_BASE |
protected ConcurrentMap<String,com.yammer.metrics.core.Histogram> |
rpcHistograms |
protected ConcurrentMap<String,com.yammer.metrics.core.Timer> |
rpcTimers |
protected MetricsConnection.RunnerStats |
runnerStats |
protected MetricsConnection.CallTracker |
scanTracker |
private String |
scope |
protected ConcurrentHashMap<ServerName,ConcurrentMap<byte[],MetricsConnection.RegionStats>> |
serverStats |
private MetricsConnection.NewMetric<com.yammer.metrics.core.Timer> |
timerFactory |
Constructor and Description |
---|
MetricsConnection(ConnectionManager.HConnectionImplementation conn) |
Modifier and Type | Method and Description |
---|---|
private <T> T |
getMetric(String key,
ConcurrentMap<String,T> map,
MetricsConnection.NewMetric<T> factory)
Get a metric for
key from map , or create it with factory . |
void |
incrDelayRunners()
Increment the number of delay runner counts.
|
void |
incrMetaCacheHit()
Increment the number of meta cache hits.
|
void |
incrMetaCacheMiss()
Increment the number of meta cache misses.
|
void |
incrNormalRunners()
Increment the number of normal runner counts.
|
static MetricsConnection.CallStats |
newCallStats()
Produce an instance of
MetricsConnection.CallStats for clients to attach to RPCs. |
void |
shutdown() |
void |
updateDelayInterval(long interval)
Update delay interval of delay runner.
|
void |
updateRpc(com.google.protobuf.Descriptors.MethodDescriptor method,
com.google.protobuf.Message param,
MetricsConnection.CallStats stats)
Report RPC context to metrics system.
|
private void |
updateRpcGeneric(com.google.protobuf.Descriptors.MethodDescriptor method,
MetricsConnection.CallStats stats)
Update call stats for non-critical-path methods
|
void |
updateServerStats(ServerName serverName,
byte[] regionName,
Object r) |
public static final String CLIENT_SIDE_METRICS_ENABLED_KEY
true
to enable metrics collection of client requests.private static final String DRTN_BASE
private static final String REQ_BASE
private static final String RESP_BASE
private static final String MEMLOAD_BASE
private static final String HEAP_BASE
private static final String CLIENT_SVC
protected ConcurrentHashMap<ServerName,ConcurrentMap<byte[],MetricsConnection.RegionStats>> serverStats
private static final int CAPACITY
private static final float LOAD_FACTOR
HashMap.DEFAULT_LOAD_FACTOR
private static final int CONCURRENCY_LEVEL
ConnectionManager.HConnectionImplementation.getBatchPool()
private final com.yammer.metrics.core.MetricsRegistry registry
private final com.yammer.metrics.reporting.JmxReporter reporter
private final String scope
private final MetricsConnection.NewMetric<com.yammer.metrics.core.Timer> timerFactory
private final MetricsConnection.NewMetric<com.yammer.metrics.core.Histogram> histogramFactory
protected final com.yammer.metrics.core.Counter metaCacheHits
protected final com.yammer.metrics.core.Counter metaCacheMisses
protected final MetricsConnection.CallTracker getTracker
protected final MetricsConnection.CallTracker scanTracker
protected final MetricsConnection.CallTracker appendTracker
protected final MetricsConnection.CallTracker deleteTracker
protected final MetricsConnection.CallTracker incrementTracker
protected final MetricsConnection.CallTracker putTracker
protected final MetricsConnection.CallTracker multiTracker
protected final MetricsConnection.RunnerStats runnerStats
protected final ConcurrentMap<String,com.yammer.metrics.core.Timer> rpcTimers
protected final ConcurrentMap<String,com.yammer.metrics.core.Histogram> rpcHistograms
public MetricsConnection(ConnectionManager.HConnectionImplementation conn)
public void updateServerStats(ServerName serverName, byte[] regionName, Object r)
public void shutdown()
public static MetricsConnection.CallStats newCallStats()
MetricsConnection.CallStats
for clients to attach to RPCs.public void incrMetaCacheHit()
public void incrMetaCacheMiss()
public void incrNormalRunners()
public void incrDelayRunners()
public void updateDelayInterval(long interval)
private <T> T getMetric(String key, ConcurrentMap<String,T> map, MetricsConnection.NewMetric<T> factory)
key
from map
, or create it with factory
.private void updateRpcGeneric(com.google.protobuf.Descriptors.MethodDescriptor method, MetricsConnection.CallStats stats)
public void updateRpc(com.google.protobuf.Descriptors.MethodDescriptor method, com.google.protobuf.Message param, MetricsConnection.CallStats stats)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.