@Test public void getCommandMetrics() { List<CommandMetricsRegistry.CommandMetric> commands = testSubject.getCommandMetrics(principal); assertEquals(1, commands.size()); assertEquals("Target." + testclient.getContext(), commands.get(0).getClientId()); assertEquals(0, commands.get(0).getCount()); commandMetricsRegistry.add("Sample", "Source", "Target", testclient.getContext(), 1); commands = testSubject.getCommandMetrics(principal); assertEquals(1, commands.size()); assertEquals("Target." + testclient.getContext(), commands.get(0).getClientId()); assertEquals(1, commands.get(0).getCount()); }
@GetMapping("/command-metrics") public List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal) { auditLog.debug("[{}] Request to list command metrics.", AuditLog.username(principal)); List<CommandMetricsRegistry.CommandMetric> metrics = new ArrayList<>(); commandRegistrationCache.getAll().forEach((commandHander, registrations) -> metrics .addAll(getMetrics(commandHander, registrations))); return metrics; }
MetricsRestController { @GetMapping("/command-metrics") public List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal) { auditLog.debug("[{}] Request to list command metrics.", AuditLog.username(principal)); List<CommandMetricsRegistry.CommandMetric> metrics = new ArrayList<>(); commandRegistrationCache.getAll().forEach((commandHander, registrations) -> metrics .addAll(getMetrics(commandHander, registrations))); return metrics; } }
MetricsRestController { @GetMapping("/command-metrics") public List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal) { auditLog.debug("[{}] Request to list command metrics.", AuditLog.username(principal)); List<CommandMetricsRegistry.CommandMetric> metrics = new ArrayList<>(); commandRegistrationCache.getAll().forEach((commandHander, registrations) -> metrics .addAll(getMetrics(commandHander, registrations))); return metrics; } MetricsRestController(CommandRegistrationCache commandRegistrationCache,
                                 CommandMetricsRegistry commandMetricsRegistry,
                                 QueryRegistrationCache queryRegistrationCache,
                                 QueryMetricsRegistry queryMetricsRegistry); }
MetricsRestController { @GetMapping("/command-metrics") public List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal) { auditLog.debug("[{}] Request to list command metrics.", AuditLog.username(principal)); List<CommandMetricsRegistry.CommandMetric> metrics = new ArrayList<>(); commandRegistrationCache.getAll().forEach((commandHander, registrations) -> metrics .addAll(getMetrics(commandHander, registrations))); 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("/command-metrics") public List<CommandMetricsRegistry.CommandMetric> getCommandMetrics(final Principal principal) { auditLog.debug("[{}] Request to list command metrics.", AuditLog.username(principal)); List<CommandMetricsRegistry.CommandMetric> metrics = new ArrayList<>(); commandRegistrationCache.getAll().forEach((commandHander, registrations) -> metrics .addAll(getMetrics(commandHander, registrations))); 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);  }