@Test public void getQueryMetrics() { List<QueryMetricsRegistry.QueryMetric> queries = testSubject.getQueryMetrics(principal); assertEquals(1, queries.size()); assertEquals("Target." + queryClient.getContext(), queries.get(0).getClientId()); assertEquals(0, queries.get(0).getCount()); queryMetricsRegistry.add(new QueryDefinition("context", "query"), "Source", "Target", queryClient.getContext(), 50); queries = testSubject.getQueryMetrics(principal); assertEquals(1, queries.size()); assertEquals("Target." + queryClient.getContext(), queries.get(0).getClientId()); assertEquals(1, queries.get(0).getCount()); }
@GetMapping("/query-metrics") public List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal) { auditLog.debug("[{}] Request to list query metrics.", AuditLog.username(principal)); List<QueryMetricsRegistry.QueryMetric> metrics = new ArrayList<>(); queryRegistrationCache.getAll().forEach((queryDefinition, handlersPerComponent) -> metrics .addAll(getQueryMetrics(queryDefinition, handlersPerComponent))); return metrics; }
MetricsRestController { @GetMapping("/query-metrics") public List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal) { auditLog.debug("[{}] Request to list query metrics.", AuditLog.username(principal)); List<QueryMetricsRegistry.QueryMetric> metrics = new ArrayList<>(); queryRegistrationCache.getAll().forEach((queryDefinition, handlersPerComponent) -> metrics .addAll(getQueryMetrics(queryDefinition, handlersPerComponent))); return metrics; } }
MetricsRestController { @GetMapping("/query-metrics") public List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal) { auditLog.debug("[{}] Request to list query metrics.", AuditLog.username(principal)); List<QueryMetricsRegistry.QueryMetric> metrics = new ArrayList<>(); queryRegistrationCache.getAll().forEach((queryDefinition, handlersPerComponent) -> metrics .addAll(getQueryMetrics(queryDefinition, handlersPerComponent))); return metrics; } MetricsRestController(CommandRegistrationCache commandRegistrationCache,
                                 CommandMetricsRegistry commandMetricsRegistry,
                                 QueryRegistrationCache queryRegistrationCache,
                                 QueryMetricsRegistry queryMetricsRegistry); }
MetricsRestController { @GetMapping("/query-metrics") public List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal) { auditLog.debug("[{}] Request to list query metrics.", AuditLog.username(principal)); List<QueryMetricsRegistry.QueryMetric> metrics = new ArrayList<>(); queryRegistrationCache.getAll().forEach((queryDefinition, handlersPerComponent) -> metrics .addAll(getQueryMetrics(queryDefinition, handlersPerComponent))); return metrics; } MetricsRestController(CommandRegistrationCache commandRegistrationCache,
                                 CommandMetricsRegistry commandMetricsRegistry,
                                 QueryRegistrationCache queryRegistrationCache,
                                 QueryMetricsRegistry queryMetricsRegistry); @GetMapping("/command-metrics") List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal); @GetMapping("/query-metrics") List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal); }
MetricsRestController { @GetMapping("/query-metrics") public List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal) { auditLog.debug("[{}] Request to list query metrics.", AuditLog.username(principal)); List<QueryMetricsRegistry.QueryMetric> metrics = new ArrayList<>(); queryRegistrationCache.getAll().forEach((queryDefinition, handlersPerComponent) -> metrics .addAll(getQueryMetrics(queryDefinition, handlersPerComponent))); return metrics; } MetricsRestController(CommandRegistrationCache commandRegistrationCache,
                                 CommandMetricsRegistry commandMetricsRegistry,
                                 QueryRegistrationCache queryRegistrationCache,
                                 QueryMetricsRegistry queryMetricsRegistry); @GetMapping("/command-metrics") List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal); @GetMapping("/query-metrics") List<QueryMetricsRegistry.QueryMetric> getQueryMetrics(final Principal principal);  }