Search in sources :

Example 1 with Counter

use of com.yammer.metrics.core.Counter in project bagheera by mozilla-metrics.

the class HttpMetric method updateResponseMetrics.

public void updateResponseMetrics(int status) {
    if (responseCodeCounts.containsKey(status)) {
        responseCodeCounts.get(status).inc();
    } else {
        Counter statusCounter = Metrics.newCounter(new MetricName(DEFAULT_GROUP, DEFAULT_TYPE, this.id + ".response." + status));
        statusCounter.inc();
        responseCodeCounts.put(status, statusCounter);
    }
}
Also used : MetricName(com.yammer.metrics.core.MetricName) Counter(com.yammer.metrics.core.Counter)

Example 2 with Counter

use of com.yammer.metrics.core.Counter in project pinot by linkedin.

the class AggregatedCounter method refresh.

/**
   * Update counter from underlying counters.
   */
public void refresh() {
    long count = 0;
    for (Metric m : _counters) {
        if (m instanceof Counter) {
            count += ((Counter) m).count();
        } else if (m instanceof AggregatedCounter) {
            count += ((AggregatedCounter) m).count();
        }
    }
    _count = count;
}
Also used : Counter(com.yammer.metrics.core.Counter) Metric(com.yammer.metrics.core.Metric)

Aggregations

Counter (com.yammer.metrics.core.Counter)2 Metric (com.yammer.metrics.core.Metric)1 MetricName (com.yammer.metrics.core.MetricName)1