HBASE-11143 Improve replication metrics.
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1594468 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
01f6b9540b
commit
9be1c51427
|
@ -36,6 +36,7 @@ public class MetricsSource {
|
||||||
public static final String SOURCE_LOG_EDITS_READ = "source.logEditsRead";
|
public static final String SOURCE_LOG_EDITS_READ = "source.logEditsRead";
|
||||||
public static final String SOURCE_LOG_EDITS_FILTERED = "source.logEditsFiltered";
|
public static final String SOURCE_LOG_EDITS_FILTERED = "source.logEditsFiltered";
|
||||||
public static final String SOURCE_SHIPPED_BATCHES = "source.shippedBatches";
|
public static final String SOURCE_SHIPPED_BATCHES = "source.shippedBatches";
|
||||||
|
public static final String SOURCE_SHIPPED_KBS = "source.shippedKBs";
|
||||||
public static final String SOURCE_SHIPPED_OPS = "source.shippedOps";
|
public static final String SOURCE_SHIPPED_OPS = "source.shippedOps";
|
||||||
public static final String SOURCE_LOG_READ_IN_BYTES = "source.logReadInBytes";
|
public static final String SOURCE_LOG_READ_IN_BYTES = "source.logReadInBytes";
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ public class MetricsSource {
|
||||||
private String logEditsFilteredKey;
|
private String logEditsFilteredKey;
|
||||||
private final String shippedBatchesKey;
|
private final String shippedBatchesKey;
|
||||||
private final String shippedOpsKey;
|
private final String shippedOpsKey;
|
||||||
|
private final String shippedKBsKey;
|
||||||
private final String logReadInBytesKey;
|
private final String logReadInBytesKey;
|
||||||
|
|
||||||
private MetricsReplicationSource rms;
|
private MetricsReplicationSource rms;
|
||||||
|
@ -69,6 +71,7 @@ public class MetricsSource {
|
||||||
logEditsFilteredKey = "source." + id + ".logEditsFiltered";
|
logEditsFilteredKey = "source." + id + ".logEditsFiltered";
|
||||||
shippedBatchesKey = "source." + this.id + ".shippedBatches";
|
shippedBatchesKey = "source." + this.id + ".shippedBatches";
|
||||||
shippedOpsKey = "source." + this.id + ".shippedOps";
|
shippedOpsKey = "source." + this.id + ".shippedOps";
|
||||||
|
shippedKBsKey = "source." + this.id + ".shippedKBs";
|
||||||
logReadInBytesKey = "source." + this.id + ".logReadInBytes";
|
logReadInBytesKey = "source." + this.id + ".logReadInBytes";
|
||||||
rms = CompatibilitySingletonFactory.getInstance(MetricsReplicationSource.class);
|
rms = CompatibilitySingletonFactory.getInstance(MetricsReplicationSource.class);
|
||||||
}
|
}
|
||||||
|
@ -141,11 +144,13 @@ public class MetricsSource {
|
||||||
*
|
*
|
||||||
* @param batchSize the size of the batch that was shipped to sinks.
|
* @param batchSize the size of the batch that was shipped to sinks.
|
||||||
*/
|
*/
|
||||||
public void shipBatch(long batchSize) {
|
public void shipBatch(long batchSize, int sizeInKB) {
|
||||||
rms.incCounters(shippedBatchesKey, 1);
|
rms.incCounters(shippedBatchesKey, 1);
|
||||||
rms.incCounters(SOURCE_SHIPPED_BATCHES, 1);
|
rms.incCounters(SOURCE_SHIPPED_BATCHES, 1);
|
||||||
rms.incCounters(shippedOpsKey, batchSize);
|
rms.incCounters(shippedOpsKey, batchSize);
|
||||||
rms.incCounters(SOURCE_SHIPPED_OPS, batchSize);
|
rms.incCounters(SOURCE_SHIPPED_OPS, batchSize);
|
||||||
|
rms.incCounters(shippedKBsKey, sizeInKB);
|
||||||
|
rms.incCounters(SOURCE_SHIPPED_KBS, sizeInKB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** increase the byte number read by source from log file */
|
/** increase the byte number read by source from log file */
|
||||||
|
|
|
@ -738,7 +738,7 @@ public class ReplicationSource extends Thread
|
||||||
}
|
}
|
||||||
this.totalReplicatedEdits += entries.size();
|
this.totalReplicatedEdits += entries.size();
|
||||||
this.totalReplicatedOperations += currentNbOperations;
|
this.totalReplicatedOperations += currentNbOperations;
|
||||||
this.metrics.shipBatch(this.currentNbOperations);
|
this.metrics.shipBatch(this.currentNbOperations, this.currentSize/1024);
|
||||||
this.metrics.setAgeOfLastShippedOp(entries.get(entries.size()-1).getKey().getWriteTime());
|
this.metrics.setAgeOfLastShippedOp(entries.get(entries.size()-1).getKey().getWriteTime());
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("Replicated " + this.totalReplicatedEdits + " entries in total, or "
|
LOG.trace("Replicated " + this.totalReplicatedEdits + " entries in total, or "
|
||||||
|
|
Loading…
Reference in New Issue