Search in sources :

Example 1 with CounterMetric

use of org.opensearch.common.metrics.CounterMetric in project OpenSearch by opensearch-project.

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);
        }
    }
}
Also used : CounterMetric(org.opensearch.common.metrics.CounterMetric)

Example 2 with CounterMetric

use of org.opensearch.common.metrics.CounterMetric in project OpenSearch by opensearch-project.

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());
        }
    }
}
Also used : CounterMetric(org.opensearch.common.metrics.CounterMetric)

Aggregations

CounterMetric (org.opensearch.common.metrics.CounterMetric)2