Search in sources :

Example 1 with Sampler

use of org.apache.cassandra.metrics.Sampler in project cassandra by apache.

the class ColumnFamilyStore method finishLocalSampling.

@SuppressWarnings({ "rawtypes", "unchecked" })
public List<CompositeData> finishLocalSampling(String sampler, int count) throws OpenDataException {
    Sampler samplerImpl = metric.samplers.get(SamplerType.valueOf(sampler));
    List<Sample> samplerResults = samplerImpl.finishSampling(count);
    List<CompositeData> result = new ArrayList<>(count);
    for (Sample counter : samplerResults) {
        // Not duplicating the buffer for safety because AbstractSerializer and ByteBufferUtil.bytesToHex
        // don't modify position or limit
        result.add(new CompositeDataSupport(COUNTER_COMPOSITE_TYPE, COUNTER_NAMES, new Object[] { keyspace.getName() + "." + name, counter.count, counter.error, // string
        samplerImpl.toString(counter.value) }));
    }
    return result;
}
Also used : Sample(org.apache.cassandra.metrics.Sampler.Sample) Sampler(org.apache.cassandra.metrics.Sampler)

Aggregations

Sampler (org.apache.cassandra.metrics.Sampler)1 Sample (org.apache.cassandra.metrics.Sampler.Sample)1