mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
Add size label for store metrics.
This commit is contained in:
@@ -21,7 +21,6 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static com.alibaba.otter.canal.prometheus.CanalInstanceExports.DEST;
|
||||
import static com.alibaba.otter.canal.prometheus.CanalInstanceExports.DEST_LABELS_LIST;
|
||||
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
|
||||
/**
|
||||
* @author Chuanyi Li
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StoreCollector extends Collector implements InstanceRegistry {
|
||||
private static final String PRODUCE_MEM_HELP = "Produced mem bytes of canal instance";
|
||||
private static final String CONSUME_MEM_HELP = "Consumed mem bytes of canal instance";
|
||||
private final ConcurrentMap<String, StoreMetricsHolder> instances = new ConcurrentHashMap<String, StoreMetricsHolder>();
|
||||
private final List<String> storeLabelsList = Arrays.asList(DEST, "batchMode");
|
||||
private final List<String> storeLabelsList = Arrays.asList(DEST, "batchMode", "size");
|
||||
|
||||
private StoreCollector() {}
|
||||
|
||||
@@ -100,7 +100,8 @@ public class StoreCollector extends Collector implements InstanceRegistry {
|
||||
holder.putSeq = memStore.getPutSequence();
|
||||
holder.ackSeq = memStore.getAckSequence();
|
||||
holder.destLabelValues = Collections.singletonList(destination);
|
||||
holder.storeLabelValues = Arrays.asList(destination, memStore.getBatchMode().name());
|
||||
holder.size = memStore.getBufferSize();
|
||||
holder.storeLabelValues = Arrays.asList(destination, holder.batchMode.name(), Integer.toString(holder.size));
|
||||
Preconditions.checkNotNull(holder.batchMode);
|
||||
Preconditions.checkNotNull(holder.putSeq);
|
||||
Preconditions.checkNotNull(holder.ackSeq);
|
||||
@@ -128,6 +129,7 @@ public class StoreCollector extends Collector implements InstanceRegistry {
|
||||
private BatchMode batchMode;
|
||||
private AtomicLong putMemSize;
|
||||
private AtomicLong ackMemSize;
|
||||
private int size;
|
||||
private List<String> destLabelValues;
|
||||
private List<String> storeLabelValues;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user