[improve](fe) Add a counter metric for recording large editlog write (#37328) (#37474)

This commit is contained in:
Lei Zhang
2024-07-09 17:16:31 +08:00
committed by GitHub
parent 7cda8db020
commit 7f6b846f58
2 changed files with 14 additions and 2 deletions

View File

@ -241,8 +241,12 @@ public class BDBJEJournal implements Journal { // CHECKSTYLE IGNORE THIS LINE: B
MetricRepo.COUNTER_EDIT_LOG_SIZE_BYTES.increase((long) theData.getSize());
MetricRepo.COUNTER_CURRENT_EDIT_LOG_SIZE_BYTES.increase((long) theData.getSize());
}
if (LOG.isDebugEnabled()) {
LOG.debug("opCode = {}, journal size = {}", op, theData.getSize());
if (LOG.isDebugEnabled() || theData.getSize() > (1 << 20)) {
LOG.info("opCode = {}, journal size = {}", op, theData.getSize());
if (MetricRepo.isInit) {
MetricRepo.COUNTER_LARGE_EDIT_LOG.increase(1L);
}
}
// Write the key value pair to bdb.

View File

@ -95,6 +95,8 @@ public final class MetricRepo {
public static LongCounterMetric COUNTER_CURRENT_EDIT_LOG_SIZE_BYTES;
public static LongCounterMetric COUNTER_EDIT_LOG_CLEAN_SUCCESS;
public static LongCounterMetric COUNTER_EDIT_LOG_CLEAN_FAILED;
public static LongCounterMetric COUNTER_LARGE_EDIT_LOG;
public static Histogram HISTO_EDIT_LOG_WRITE_LATENCY;
public static Histogram HISTO_JOURNAL_BATCH_SIZE;
public static Histogram HISTO_JOURNAL_BATCH_DATA_SIZE;
@ -381,6 +383,12 @@ public final class MetricRepo {
"size of current edit log");
COUNTER_CURRENT_EDIT_LOG_SIZE_BYTES.addLabel(new MetricLabel("type", "current_bytes"));
DORIS_METRIC_REGISTER.addMetrics(COUNTER_CURRENT_EDIT_LOG_SIZE_BYTES);
COUNTER_LARGE_EDIT_LOG = new LongCounterMetric("edit_log", MetricUnit.OPERATIONS,
"counter of large edit log write into bdbje");
COUNTER_LARGE_EDIT_LOG.addLabel(new MetricLabel("type", "large_write"));
DORIS_METRIC_REGISTER.addMetrics(COUNTER_LARGE_EDIT_LOG);
HISTO_EDIT_LOG_WRITE_LATENCY = METRIC_REGISTER.histogram(
MetricRegistry.name("editlog", "write", "latency", "ms"));
HISTO_JOURNAL_BATCH_SIZE = METRIC_REGISTER.histogram(