org.apache.hadoop.hbase.replication.regionserver
Class MetricsSource

java.lang.Object
  extended by org.apache.hadoop.hbase.replication.regionserver.MetricsSource
All Implemented Interfaces:
BaseSource

@InterfaceAudience.LimitedPrivate(value="Replication")
public class MetricsSource
extends Object
implements BaseSource

This class is for maintaining the various replication statistics for a source and publishing them through the metrics interfaces.


Field Summary
static org.apache.commons.logging.Log LOG
           
static String SOURCE_AGE_OF_LAST_SHIPPED_OP
           
static String SOURCE_LOG_EDITS_FILTERED
           
static String SOURCE_LOG_EDITS_READ
           
static String SOURCE_LOG_READ_IN_BYTES
           
static String SOURCE_SHIPPED_BATCHES
           
static String SOURCE_SHIPPED_KBS
           
static String SOURCE_SHIPPED_OPS
           
static String SOURCE_SIZE_OF_LOG_QUEUE
           
 
Fields inherited from interface org.apache.hadoop.hbase.metrics.BaseSource
HBASE_METRICS_SYSTEM_NAME
 
Constructor Summary
MetricsSource(String id)
          Constructor used to register the metrics
MetricsSource(String id, MetricsReplicationSourceSource singleSourceSource, MetricsReplicationSourceSource globalSourceSource)
          Constructor for injecting custom (or test) MetricsReplicationSourceSources
 
Method Summary
 void clear()
          Removes all metrics about this Source.
 void decGauge(String gaugeName, long delta)
           
 Long getAgeOfLastShippedOp()
          Get AgeOfLastShippedOp
 String getMetricsContext()
           
 String getMetricsDescription()
           
 String getMetricsJmxContext()
           
 String getMetricsName()
           
 String getPeerID()
          Get the slave peer ID
 int getSizeOfLogQueue()
          Get the sizeOfLogQueue
 long getTimeStampOfLastShippedOp()
          Get the timeStampsOfLastShippedOp
 void incCounters(String counterName, long delta)
           
 void incGauge(String gaugeName, long delta)
           
 void incrBytesSkippedInUncleanlyClosedWALs(long bytes)
           
 void incrCompletedRecoveryQueue()
           
 void incrCompletedWAL()
           
 void incrLogEditsFiltered()
          The number of log edits filtered out.
 void incrLogEditsRead()
          Increment the number of log edits read by one.
 void incrLogReadInBytes(long readInBytes)
          increase the byte number read by source from log file
 void incrRepeatedFileBytes(long bytes)
           
 void incrRestartedWALReading()
           
 void incrUncleanlyClosedWALs()
           
 void incrUnknownFileLengthForClosedWAL()
           
 void init()
           
 void refreshAgeOfLastShippedOp()
          Convenience method to use the last given timestamp to refresh the age of the last edit.
 void removeMetric(String key)
           
 void setAgeOfLastShippedOp(long timestamp)
          Set the age of the last edit that was shipped
 void setGauge(String gaugeName, long value)
           
 void setSizeOfLogQueue(int size)
          Set the size of the log queue
 void shipBatch(long batchSize, int sizeInBytes)
          Convience method to apply changes to metrics do to shipping a batch of logs.
 void updateHistogram(String name, long value)
           
 void updateQuantile(String name, long value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG

SOURCE_SIZE_OF_LOG_QUEUE

public static final String SOURCE_SIZE_OF_LOG_QUEUE
See Also:
Constant Field Values

SOURCE_AGE_OF_LAST_SHIPPED_OP

public static final String SOURCE_AGE_OF_LAST_SHIPPED_OP
See Also:
Constant Field Values

SOURCE_LOG_EDITS_READ

public static final String SOURCE_LOG_EDITS_READ
See Also:
Constant Field Values

SOURCE_LOG_EDITS_FILTERED

public static final String SOURCE_LOG_EDITS_FILTERED
See Also:
Constant Field Values

SOURCE_SHIPPED_BATCHES

public static final String SOURCE_SHIPPED_BATCHES
See Also:
Constant Field Values

SOURCE_SHIPPED_KBS

public static final String SOURCE_SHIPPED_KBS
See Also:
Constant Field Values

SOURCE_SHIPPED_OPS

public static final String SOURCE_SHIPPED_OPS
See Also:
Constant Field Values

SOURCE_LOG_READ_IN_BYTES

public static final String SOURCE_LOG_READ_IN_BYTES
See Also:
Constant Field Values
Constructor Detail

MetricsSource

public MetricsSource(String id)
Constructor used to register the metrics

Parameters:
id - Name of the source this class is monitoring

MetricsSource

public MetricsSource(String id,
                     MetricsReplicationSourceSource singleSourceSource,
                     MetricsReplicationSourceSource globalSourceSource)
Constructor for injecting custom (or test) MetricsReplicationSourceSources

Parameters:
id - Name of the source this class is monitoring
singleSourceSource - Class to monitor id-scoped metrics
globalSourceSource - Class to monitor global-scoped metrics
Method Detail

setAgeOfLastShippedOp

public void setAgeOfLastShippedOp(long timestamp)
Set the age of the last edit that was shipped

Parameters:
timestamp - write time of the edit

refreshAgeOfLastShippedOp

public void refreshAgeOfLastShippedOp()
Convenience method to use the last given timestamp to refresh the age of the last edit. Used when replication fails and need to keep that metric accurate.


setSizeOfLogQueue

public void setSizeOfLogQueue(int size)
Set the size of the log queue

Parameters:
size - the size.

incrLogEditsRead

public void incrLogEditsRead()
Increment the number of log edits read by one.


incrLogEditsFiltered

public void incrLogEditsFiltered()
The number of log edits filtered out.


shipBatch

public void shipBatch(long batchSize,
                      int sizeInBytes)
Convience method to apply changes to metrics do to shipping a batch of logs.

Parameters:
batchSize - the size of the batch that was shipped to sinks.

incrLogReadInBytes

public void incrLogReadInBytes(long readInBytes)
increase the byte number read by source from log file


clear

public void clear()
Removes all metrics about this Source.


getAgeOfLastShippedOp

public Long getAgeOfLastShippedOp()
Get AgeOfLastShippedOp

Returns:
AgeOfLastShippedOp

getSizeOfLogQueue

public int getSizeOfLogQueue()
Get the sizeOfLogQueue

Returns:
sizeOfLogQueue

getTimeStampOfLastShippedOp

public long getTimeStampOfLastShippedOp()
Get the timeStampsOfLastShippedOp

Returns:
lastTimestampForAge

getPeerID

public String getPeerID()
Get the slave peer ID

Returns:
peerID

incrUnknownFileLengthForClosedWAL

public void incrUnknownFileLengthForClosedWAL()

incrUncleanlyClosedWALs

public void incrUncleanlyClosedWALs()

incrBytesSkippedInUncleanlyClosedWALs

public void incrBytesSkippedInUncleanlyClosedWALs(long bytes)

incrRestartedWALReading

public void incrRestartedWALReading()

incrRepeatedFileBytes

public void incrRepeatedFileBytes(long bytes)

incrCompletedWAL

public void incrCompletedWAL()

incrCompletedRecoveryQueue

public void incrCompletedRecoveryQueue()

init

public void init()
Specified by:
init in interface BaseSource

setGauge

public void setGauge(String gaugeName,
                     long value)
Specified by:
setGauge in interface BaseSource

incGauge

public void incGauge(String gaugeName,
                     long delta)
Specified by:
incGauge in interface BaseSource

decGauge

public void decGauge(String gaugeName,
                     long delta)
Specified by:
decGauge in interface BaseSource

removeMetric

public void removeMetric(String key)
Specified by:
removeMetric in interface BaseSource

incCounters

public void incCounters(String counterName,
                        long delta)
Specified by:
incCounters in interface BaseSource

updateHistogram

public void updateHistogram(String name,
                            long value)
Specified by:
updateHistogram in interface BaseSource

updateQuantile

public void updateQuantile(String name,
                           long value)
Specified by:
updateQuantile in interface BaseSource

getMetricsContext

public String getMetricsContext()
Specified by:
getMetricsContext in interface BaseSource

getMetricsDescription

public String getMetricsDescription()
Specified by:
getMetricsDescription in interface BaseSource

getMetricsJmxContext

public String getMetricsJmxContext()
Specified by:
getMetricsJmxContext in interface BaseSource

getMetricsName

public String getMetricsName()
Specified by:
getMetricsName in interface BaseSource


Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.