diff --git a/cameleer3-server-app/src/main/java/com/cameleer3/server/app/controller/SearchController.java b/cameleer3-server-app/src/main/java/com/cameleer3/server/app/controller/SearchController.java index c52b5e5f..b09e07ab 100644 --- a/cameleer3-server-app/src/main/java/com/cameleer3/server/app/controller/SearchController.java +++ b/cameleer3-server-app/src/main/java/com/cameleer3/server/app/controller/SearchController.java @@ -52,14 +52,12 @@ public class SearchController { @RequestParam(required = false) String agentId, @RequestParam(required = false) String processorType, @RequestParam(required = false) String application, - @RequestParam(required = false) String group, @RequestParam(defaultValue = "0") int offset, @RequestParam(defaultValue = "50") int limit, @RequestParam(required = false) String sortField, @RequestParam(required = false) String sortDir) { - String app = application != null ? application : group; - List agentIds = resolveApplicationToAgentIds(app); + List agentIds = resolveApplicationToAgentIds(application); SearchRequest request = new SearchRequest( status, timeFrom, timeTo, @@ -67,7 +65,7 @@ public class SearchController { correlationId, text, null, null, null, routeId, agentId, processorType, - app, agentIds, + application, agentIds, offset, limit, sortField, sortDir ); @@ -94,13 +92,15 @@ public class SearchController { @RequestParam Instant from, @RequestParam(required = false) Instant to, @RequestParam(required = false) String routeId, - @RequestParam(required = false) String application, - @RequestParam(required = false) String group) { + @RequestParam(required = false) String application) { Instant end = to != null ? to : Instant.now(); - List agentIds = resolveApplicationToAgentIds(application != null ? application : group); - if (routeId == null && agentIds == null) { + if (routeId == null && application == null) { return ResponseEntity.ok(searchService.stats(from, end)); } + if (routeId == null) { + return ResponseEntity.ok(searchService.statsForApp(from, end, application)); + } + List agentIds = resolveApplicationToAgentIds(application); return ResponseEntity.ok(searchService.stats(from, end, routeId, agentIds)); } @@ -111,10 +111,15 @@ public class SearchController { @RequestParam(required = false) Instant to, @RequestParam(defaultValue = "24") int buckets, @RequestParam(required = false) String routeId, - @RequestParam(required = false) String application, - @RequestParam(required = false) String group) { + @RequestParam(required = false) String application) { Instant end = to != null ? to : Instant.now(); - List agentIds = resolveApplicationToAgentIds(application != null ? application : group); + if (routeId == null && application == null) { + return ResponseEntity.ok(searchService.timeseries(from, end, buckets)); + } + if (routeId == null) { + return ResponseEntity.ok(searchService.timeseriesForApp(from, end, buckets, application)); + } + List agentIds = resolveApplicationToAgentIds(application); if (routeId == null && agentIds == null) { return ResponseEntity.ok(searchService.timeseries(from, end, buckets)); } diff --git a/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java b/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java index 014c606d..7389bfe5 100644 --- a/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java +++ b/cameleer3-server-core/src/main/java/com/cameleer3/server/core/search/SearchService.java @@ -28,6 +28,10 @@ public class SearchService { return statsStore.stats(from, to); } + public ExecutionStats statsForApp(Instant from, Instant to, String applicationName) { + return statsStore.statsForApp(from, to, applicationName); + } + public ExecutionStats stats(Instant from, Instant to, String routeId, List agentIds) { return statsStore.statsForRoute(from, to, routeId, agentIds); } @@ -36,6 +40,10 @@ public class SearchService { return statsStore.timeseries(from, to, bucketCount); } + public StatsTimeseries timeseriesForApp(Instant from, Instant to, int bucketCount, String applicationName) { + return statsStore.timeseriesForApp(from, to, bucketCount, applicationName); + } + public StatsTimeseries timeseries(Instant from, Instant to, int bucketCount, String routeId, List agentIds) { return statsStore.timeseriesForRoute(from, to, bucketCount, routeId, agentIds);