Search in sources :

Example 1 with CounterMetricData

use of org.gluu.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 : MetricType(org.gluu.model.metric.MetricType) TimerMetricEntry(org.gluu.model.metric.timer.TimerMetricEntry) MetricEntry(org.gluu.model.metric.ldap.MetricEntry) CounterMetricEntry(org.gluu.model.metric.counter.CounterMetricEntry) CounterMetricEntry(org.gluu.model.metric.counter.CounterMetricEntry) CounterMetricData(org.gluu.model.metric.counter.CounterMetricData)

Aggregations

MetricType (org.gluu.model.metric.MetricType)1 CounterMetricData (org.gluu.model.metric.counter.CounterMetricData)1 CounterMetricEntry (org.gluu.model.metric.counter.CounterMetricEntry)1 MetricEntry (org.gluu.model.metric.ldap.MetricEntry)1 TimerMetricEntry (org.gluu.model.metric.timer.TimerMetricEntry)1