@InterfaceAudience.LimitedPrivate(value="Replication") public class MetricsSource extends Object implements BaseSource
Modifier and Type | Field and Description |
---|---|
private Map<String,Long> |
ageOfLastShippedOp |
private MetricsReplicationSourceSource |
globalSourceSource |
private String |
id |
private long |
lastHFileRefsQueueSize |
private Map<String,Long> |
lastTimestamps |
private static org.slf4j.Logger |
LOG |
private MetricsReplicationSourceSource |
singleSourceSource |
private Map<String,MetricsReplicationSourceSource> |
singleSourceSourceByTable |
HBASE_METRICS_SYSTEM_NAME
Constructor and Description |
---|
MetricsSource(String id)
Constructor used to register the metrics
|
MetricsSource(String id,
MetricsReplicationSourceSource singleSourceSource,
MetricsReplicationSourceSource globalSourceSource,
Map<String,MetricsReplicationSourceSource> singleSourceSourceByTable)
Constructor for injecting custom (or test) MetricsReplicationSourceSources
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all metrics about this Source.
|
void |
decGauge(String gaugeName,
long delta)
Subtract some amount from a gauge.
|
void |
decrSizeOfHFileRefsQueue(int size) |
void |
decrSizeOfLogQueue() |
Long |
getAgeOfLastShippedOp()
Get AgeOfLastShippedOp
|
long |
getAgeofLastShippedOp(String walGroup)
get age of last shipped op of given wal group.
|
long |
getLastTimeStampOfWalGroup(String walGroup)
get the last timestamp of given wal group.
|
String |
getMetricsContext()
Get the metrics context.
|
String |
getMetricsDescription()
Get the description of what this source exposes.
|
String |
getMetricsJmxContext()
Get the name of the context in JMX that this source will be exposed through.
|
String |
getMetricsName()
Get the name of the metrics that are being exported by this source.
|
String |
getPeerID()
Get the slave peer ID
|
Map<String,MetricsReplicationSourceSource> |
getSingleSourceSourceByTable() |
int |
getSizeOfLogQueue()
Get the sizeOfLogQueue
|
long |
getTimestampOfLastShippedOp()
Get the timestampsOfLastShippedOp, if there are multiple groups, return the latest one
|
long |
getTimeStampOfLastShippedOp()
Deprecated.
Since 2.0.0. Removed in 3.0.0.
|
void |
incCounters(String counterName,
long delta)
Add some amount to a counter.
|
void |
incGauge(String gaugeName,
long delta)
Add some amount to a gauge.
|
void |
incrBytesSkippedInUncleanlyClosedWALs(long bytes) |
void |
incrCompletedRecoveryQueue() |
void |
incrCompletedWAL() |
void |
incrFailedRecoveryQueue() |
void |
incrLogEditsFiltered()
The number of log edits filtered out.
|
void |
incrLogEditsFiltered(long delta)
Add on the number of log edits filtered
|
void |
incrLogEditsRead()
Increment the number of log edits read by one.
|
private void |
incrLogEditsRead(long delta)
Add on the the number of log edits read
|
void |
incrLogReadInBytes(long readInBytes)
increase the byte number read by source from log file
|
void |
incrRepeatedFileBytes(long bytes) |
void |
incrRestartedWALReading() |
void |
incrSizeOfHFileRefsQueue(long size) |
void |
incrSizeOfLogQueue()
Increment size of the log queue.
|
void |
incrUncleanlyClosedWALs() |
void |
incrUnknownFileLengthForClosedWAL() |
void |
init()
Clear out the metrics and re-prepare the source.
|
void |
refreshAgeOfLastShippedOp(String walGroupId)
Convenience method to use the last given timestamp to refresh the age of the last edit.
|
void |
removeMetric(String key)
Remove a metric and no longer announce it.
|
void |
setAgeOfLastShippedOp(long timestamp,
String walGroup)
Set the age of the last edit that was shipped
|
void |
setAgeOfLastShippedOpByTable(long timestamp,
String tableName)
Set the age of the last edit that was shipped group by table
|
void |
setGauge(String gaugeName,
long value)
Set a gauge to a specific value.
|
void |
shipBatch(long batchSize,
int sizeInBytes)
Convience method to apply changes to metrics do to shipping a batch of logs.
|
void |
shipBatch(long batchSize,
int sizeInBytes,
long hfiles)
Convience method to apply changes to metrics do to shipping a batch of logs.
|
void |
updateHistogram(String name,
long value)
Add some value to a histogram.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetricRegistryInfo
private static final org.slf4j.Logger LOG
private Map<String,Long> lastTimestamps
private Map<String,Long> ageOfLastShippedOp
private long lastHFileRefsQueueSize
private final MetricsReplicationSourceSource singleSourceSource
private final MetricsReplicationSourceSource globalSourceSource
private Map<String,MetricsReplicationSourceSource> singleSourceSourceByTable
public MetricsSource(String id)
id
- Name of the source this class is monitoringpublic MetricsSource(String id, MetricsReplicationSourceSource singleSourceSource, MetricsReplicationSourceSource globalSourceSource, Map<String,MetricsReplicationSourceSource> singleSourceSourceByTable)
id
- Name of the source this class is monitoringsingleSourceSource
- Class to monitor id-scoped metricsglobalSourceSource
- Class to monitor global-scoped metricspublic void setAgeOfLastShippedOp(long timestamp, String walGroup)
timestamp
- write time of the editwalGroup
- which group we are settingpublic void setAgeOfLastShippedOpByTable(long timestamp, String tableName)
timestamp
- write time of the edittableName
- String as group and tableNamepublic long getLastTimeStampOfWalGroup(String walGroup)
walGroup
- which group we are gettingpublic long getAgeofLastShippedOp(String walGroup)
walGroup
- which group we are gettingpublic void refreshAgeOfLastShippedOp(String walGroupId)
walGroupId
- id of the group to updatepublic void incrSizeOfLogQueue()
public void decrSizeOfLogQueue()
private void incrLogEditsRead(long delta)
delta
- the number of log edits read.public void incrLogEditsRead()
public void incrLogEditsFiltered(long delta)
delta
- the number filtered.public void incrLogEditsFiltered()
public void shipBatch(long batchSize, int sizeInBytes)
batchSize
- the size of the batch that was shipped to sinks.public void shipBatch(long batchSize, int sizeInBytes, long hfiles)
batchSize
- the size of the batch that was shipped to sinks.hfiles
- total number of hfiles shipped to sinks.public void incrLogReadInBytes(long readInBytes)
public void clear()
public Long getAgeOfLastShippedOp()
public int getSizeOfLogQueue()
@Deprecated public long getTimeStampOfLastShippedOp()
getTimestampOfLastShippedOp()
public long getTimestampOfLastShippedOp()
public void incrSizeOfHFileRefsQueue(long size)
public void decrSizeOfHFileRefsQueue(int size)
public void incrUnknownFileLengthForClosedWAL()
public void incrUncleanlyClosedWALs()
public void incrBytesSkippedInUncleanlyClosedWALs(long bytes)
public void incrRestartedWALReading()
public void incrRepeatedFileBytes(long bytes)
public void incrCompletedWAL()
public void incrCompletedRecoveryQueue()
public void incrFailedRecoveryQueue()
public void init()
BaseSource
init
in interface BaseSource
public void setGauge(String gaugeName, long value)
BaseSource
setGauge
in interface BaseSource
gaugeName
- the name of the gaugevalue
- the valuepublic void incGauge(String gaugeName, long delta)
BaseSource
incGauge
in interface BaseSource
gaugeName
- the name of the gaugedelta
- the amount to change the gauge by.public void decGauge(String gaugeName, long delta)
BaseSource
decGauge
in interface BaseSource
gaugeName
- the name of the gaugedelta
- the amount to change the gauge by.public void removeMetric(String key)
BaseSource
removeMetric
in interface BaseSource
key
- Name of the gauge to remove.public void incCounters(String counterName, long delta)
BaseSource
incCounters
in interface BaseSource
counterName
- the name of the counterdelta
- the amount to change the counter by.public void updateHistogram(String name, long value)
BaseSource
updateHistogram
in interface BaseSource
name
- the name of the histogramvalue
- the value to add to the histogrampublic String getMetricsContext()
BaseSource
getMetricsContext
in interface BaseSource
public String getMetricsDescription()
BaseSource
getMetricsDescription
in interface BaseSource
public String getMetricsJmxContext()
BaseSource
getMetricsJmxContext
in interface BaseSource
public String getMetricsName()
BaseSource
getMetricsName
in interface BaseSource
public Map<String,MetricsReplicationSourceSource> getSingleSourceSourceByTable()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.