Search in sources :

Example 6 with MetricEntry

use of org.gluu.model.metric.ldap.MetricEntry in project oxCore by GluuFederation.

the class LdapEntryReporter method addMandatoryAttributes.

private void addMandatoryAttributes(MetricService metricService, Date startTime, Date endTime, List<MetricEntry> metricEntries, Date creationTime) {
    String nodeIndetifier = metricService.getNodeIndetifier();
    ApplicationType applicationType = metricService.getApplicationType();
    for (MetricEntry metricEntry : metricEntries) {
        String id = metricService.getUiqueIdentifier();
        String dn = metricService.buildDn(id, creationTime, applicationType);
        metricEntry.setId(id);
        metricEntry.setDn(dn);
        metricEntry.setApplicationType(applicationType);
        metricEntry.setNodeIndetifier(nodeIndetifier);
        metricEntry.setStartDate(startTime);
        metricEntry.setEndDate(endTime);
        metricEntry.setCreationDate(creationTime);
        metricEntry.setExpirationDate(DateUtils.addDays(creationTime, metricService.getEntryLifetimeInDays()));
        int ttl = (int) ((metricEntry.getExpirationDate().getTime() - creationTime.getTime()) / 1000L);
        metricEntry.setTtl(ttl);
    }
}
Also used : ApplicationType(org.gluu.model.ApplicationType) TimerMetricEntry(org.gluu.model.metric.timer.TimerMetricEntry) MetricEntry(org.gluu.model.metric.ldap.MetricEntry) CounterMetricEntry(org.gluu.model.metric.counter.CounterMetricEntry)

Example 7 with MetricEntry

use of org.gluu.model.metric.ldap.MetricEntry in project oxCore by GluuFederation.

the class MetricService method getExpiredMetricEntries.

public List<MetricEntry> getExpiredMetricEntries(DefaultBatchOperation<MetricEntry> batchOperation, ApplicationType applicationType, String baseDnForPeriod, Date expirationDate, int count, int chunkSize) {
    Filter expiratioStartDateFilter = Filter.createLessOrEqualFilter("oxStartDate", getEntryManager().encodeTime(baseDnForPeriod, expirationDate));
    Filter expiratioFilter = expiratioStartDateFilter;
    if (applicationType != null) {
        Filter applicationTypeFilter = Filter.createEqualityFilter("oxMetricType", applicationType.getValue());
        expiratioFilter = Filter.createANDFilter(expiratioStartDateFilter, applicationTypeFilter);
    }
    List<MetricEntry> metricEntries = getEntryManager().findEntries(baseDnForPeriod, MetricEntry.class, expiratioFilter, SearchScope.SUB, new String[] { "uniqueIdentifier" }, batchOperation, 0, count, chunkSize);
    return metricEntries;
}
Also used : Filter(org.gluu.search.filter.Filter) MetricEntry(org.gluu.model.metric.ldap.MetricEntry)

Aggregations

MetricEntry (org.gluu.model.metric.ldap.MetricEntry)7 MetricType (org.gluu.model.metric.MetricType)4 CounterMetricEntry (org.gluu.model.metric.counter.CounterMetricEntry)4 TimerMetricEntry (org.gluu.model.metric.timer.TimerMetricEntry)3 Filter (org.gluu.search.filter.Filter)2 Timer (com.codahale.metrics.Timer)1 ApplicationType (org.gluu.model.ApplicationType)1 CounterMetricData (org.gluu.model.metric.counter.CounterMetricData)1 TimerMetricData (org.gluu.model.metric.timer.TimerMetricData)1 AuthenticationChartDto (org.gluu.oxtrust.model.AuthenticationChartDto)1 DefaultBatchOperation (org.gluu.persist.model.DefaultBatchOperation)1 SimpleBranch (org.gluu.persist.model.base.SimpleBranch)1