Fixed TagMe Harvester
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@179259 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
354bc153ce
commit
6f86f199d6
|
@ -61,10 +61,30 @@ public class TagMeMethodInvocationHarvester extends BasicHarvester {
|
||||||
|
|
||||||
long numberOfInvocation = 0;
|
long numberOfInvocation = 0;
|
||||||
|
|
||||||
for(String serviceName : SERVICE_NAMES) {
|
|
||||||
|
|
||||||
List<Filter> filters = new ArrayList<>();
|
List<Filter> tagMe1Filters = new ArrayList<>();
|
||||||
filters.add(new Filter(ServiceUsageRecord.SERVICE_NAME, serviceName));
|
tagMe1Filters.add(new Filter(ServiceUsageRecord.SERVICE_NAME, TAGME));
|
||||||
|
tagMe1Filters.add(new Filter(ServiceUsageRecord.CALLED_METHOD, "tag"));
|
||||||
|
|
||||||
|
|
||||||
|
List<Filter> tagMe2Filters = new ArrayList<>();
|
||||||
|
tagMe2Filters.add(new Filter(ServiceUsageRecord.SERVICE_NAME, TAGME));
|
||||||
|
tagMe2Filters.add(new Filter(ServiceUsageRecord.CALLED_METHOD, "/tag"));
|
||||||
|
|
||||||
|
List<Filter> watFilters = new ArrayList<>();
|
||||||
|
watFilters.add(new Filter(ServiceUsageRecord.SERVICE_NAME, WAT));
|
||||||
|
|
||||||
|
|
||||||
|
List<Filter> swatFilters = new ArrayList<>();
|
||||||
|
swatFilters.add(new Filter(ServiceUsageRecord.SERVICE_NAME, SWAT));
|
||||||
|
|
||||||
|
List<List<Filter>> allfilters = new ArrayList<>();
|
||||||
|
allfilters.add(tagMe1Filters);
|
||||||
|
allfilters.add(tagMe2Filters);
|
||||||
|
allfilters.add(watFilters);
|
||||||
|
allfilters.add(swatFilters);
|
||||||
|
|
||||||
|
for(List<Filter> filters : allfilters) {
|
||||||
|
|
||||||
SortedMap<Filter,SortedMap<Calendar,Info>> result = accountingPersistenceQuery.getContextTimeSeries(
|
SortedMap<Filter,SortedMap<Calendar,Info>> result = accountingPersistenceQuery.getContextTimeSeries(
|
||||||
AggregatedServiceUsageRecord.class, temporalConstraint, filters, contexts, true);
|
AggregatedServiceUsageRecord.class, temporalConstraint, filters, contexts, true);
|
||||||
|
@ -76,14 +96,15 @@ public class TagMeMethodInvocationHarvester extends BasicHarvester {
|
||||||
Calendar calendar = DateUtils.dateToCalendar(start);
|
Calendar calendar = DateUtils.dateToCalendar(start);
|
||||||
|
|
||||||
Info info = infoMap.get(calendar);
|
Info info = infoMap.get(calendar);
|
||||||
logger.debug("Service {} - {} : {}", serviceName, DateUtils.format(calendar), info);
|
logger.debug("{} : {} : {}", filters, DateUtils.format(calendar), info);
|
||||||
|
|
||||||
JSONObject jsonObject = info.getValue();
|
JSONObject jsonObject = info.getValue();
|
||||||
numberOfInvocation += jsonObject.getLong(AggregatedUsageRecord.OPERATION_COUNT);
|
long got = jsonObject.getLong(AggregatedUsageRecord.OPERATION_COUNT);
|
||||||
|
numberOfInvocation += got;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.error("No data found in {} for service {}.", context, serviceName);
|
logger.error("No data found in {} for filters {}.", context, filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue