Search in sources :

Example 1 with Statistics

use of fi.otavanopisto.muikku.plugins.schooldatapyramus.rest.cache.EntityCacheStatistics.Statistics in project muikku by otavanopisto.

the class PyramusSystemRESTService method ping.

@GET
@Path("/cache/statistics")
@RESTPermit(handling = Handling.UNSECURED)
public Response ping() {
    Map<String, Map<String, CachePathStatistics>> result = new HashMap<>();
    for (String cacheType : entityCacheStatistics.getCacheTypes()) {
        Statistics statistics = entityCacheStatistics.getStatistics(cacheType);
        Map<String, CachePathStatistics> pathStatistics = new HashMap<>();
        for (String path : statistics.getPaths()) {
            pathStatistics.put(path, new CachePathStatistics(statistics.getHits(path), statistics.getMisses(path), statistics.getSkips(path)));
        }
        result.put(cacheType, pathStatistics);
    }
    return Response.ok(result).build();
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Statistics(fi.otavanopisto.muikku.plugins.schooldatapyramus.rest.cache.EntityCacheStatistics.Statistics) EntityCacheStatistics(fi.otavanopisto.muikku.plugins.schooldatapyramus.rest.cache.EntityCacheStatistics) Path(javax.ws.rs.Path) RESTPermit(fi.otavanopisto.security.rest.RESTPermit) GET(javax.ws.rs.GET)

Aggregations

EntityCacheStatistics (fi.otavanopisto.muikku.plugins.schooldatapyramus.rest.cache.EntityCacheStatistics)1 Statistics (fi.otavanopisto.muikku.plugins.schooldatapyramus.rest.cache.EntityCacheStatistics.Statistics)1 RESTPermit (fi.otavanopisto.security.rest.RESTPermit)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1