Search in sources :

Example 1 with MetricType

use of co.cask.cdap.api.metrics.MetricType in project cdap by caskdata.

the class AggregatedMetricsEmitter method emit.

@Override
public MetricValue emit() {
    // todo CDAP-2195 - potential race condition , reseting value and type has to be done together
    long value = this.value.getAndSet(0);
    MetricType type = gaugeUsed.getAndSet(false) ? MetricType.GAUGE : MetricType.COUNTER;
    return new MetricValue(name, type, value);
}
Also used : MetricValue(co.cask.cdap.api.metrics.MetricValue) MetricType(co.cask.cdap.api.metrics.MetricType)

Aggregations

MetricType (co.cask.cdap.api.metrics.MetricType)1 MetricValue (co.cask.cdap.api.metrics.MetricValue)1