Search in sources :

Example 1 with CounterMetricData

use of org.xdi.model.metric.counter.CounterMetricData in project oxCore by GluuFederation.

the class LdapEntryReporter method builCounterEntries.

private List<MetricEntry> builCounterEntries(SortedMap<String, Counter> counters, Set<MetricType> registeredMetricTypes) {
    List<MetricEntry> result = new ArrayList<MetricEntry>();
    Set<MetricType> currentRegisteredMetricTypes = new HashSet<MetricType>(registeredMetricTypes);
    for (MetricType metricType : currentRegisteredMetricTypes) {
        Counter counter = counters.get(metricType.getValue());
        if (counter != null) {
            long count = counter.getCount();
            // Remove to avoid writing not changed statistic
            // registeredMetricTypes.remove(metricType);
            CounterMetricData counterMetricData = new CounterMetricData(count);
            CounterMetricEntry counterMetricEntry = new CounterMetricEntry();
            counterMetricEntry.setMetricData(counterMetricData);
            counterMetricEntry.setMetricType(metricType);
            result.add(counterMetricEntry);
        }
    }
    return result;
}
Also used : Counter(com.codahale.metrics.Counter) MetricType(org.xdi.model.metric.MetricType) ArrayList(java.util.ArrayList) CounterMetricEntry(org.xdi.model.metric.counter.CounterMetricEntry) TimerMetricEntry(org.xdi.model.metric.timer.TimerMetricEntry) MetricEntry(org.xdi.model.metric.ldap.MetricEntry) CounterMetricEntry(org.xdi.model.metric.counter.CounterMetricEntry) CounterMetricData(org.xdi.model.metric.counter.CounterMetricData) HashSet(java.util.HashSet)

Aggregations

Counter (com.codahale.metrics.Counter)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 MetricType (org.xdi.model.metric.MetricType)1 CounterMetricData (org.xdi.model.metric.counter.CounterMetricData)1 CounterMetricEntry (org.xdi.model.metric.counter.CounterMetricEntry)1 MetricEntry (org.xdi.model.metric.ldap.MetricEntry)1 TimerMetricEntry (org.xdi.model.metric.timer.TimerMetricEntry)1