use of org.elasticsearch.common.metrics.CounterMetric in project elasticsearch by elastic.
the class ShardFieldData method onCache.
@Override
public void onCache(ShardId shardId, String fieldName, Accountable ramUsage) {
totalMetric.inc(ramUsage.ramBytesUsed());
CounterMetric total = perFieldTotals.get(fieldName);
if (total != null) {
total.inc(ramUsage.ramBytesUsed());
} else {
total = new CounterMetric();
total.inc(ramUsage.ramBytesUsed());
CounterMetric prev = perFieldTotals.putIfAbsent(fieldName, total);
if (prev != null) {
prev.inc(ramUsage.ramBytesUsed());
}
}
}
use of org.elasticsearch.common.metrics.CounterMetric in project elasticsearch by elastic.
the class ShardFieldData method onRemoval.
@Override
public void onRemoval(ShardId shardId, String fieldName, boolean wasEvicted, long sizeInBytes) {
if (wasEvicted) {
evictionsMetric.inc();
}
if (sizeInBytes != -1) {
totalMetric.dec(sizeInBytes);
CounterMetric total = perFieldTotals.get(fieldName);
if (total != null) {
total.dec(sizeInBytes);
}
}
}
Aggregations