@Test public void audit_log_metric() { var tester = new ControllerTester(); MetricsReporter metricsReporter = createReporter(tester.controller()); HttpRequest req1 = HttpRequest.createTestRequest( "http: com.yahoo.jdisc.http.HttpRequest.Method.PUT ); req1.getJDiscRequest().setUserPrincipal(() -> "user.janedoe"); tester.controller().auditLogger().log((req1)); HttpRequest req2 = HttpRequest.createTestRequest( "http: com.yahoo.jdisc.http.HttpRequest.Method.POST ); req2.getJDiscRequest().setUserPrincipal(() -> "user.johndoe"); tester.controller().auditLogger().log((req2)); metricsReporter.maintain(); assertEquals(1, getMetric(MetricsReporter.OPERATION_PREFIX + "zone", "user.janedoe")); assertEquals(1, getMetric(MetricsReporter.OPERATION_PREFIX + "routing", "user.johndoe")); HttpRequest req3 = HttpRequest.createTestRequest( "http: com.yahoo.jdisc.http.HttpRequest.Method.PUT ); req3.getJDiscRequest().setUserPrincipal(() -> "user.janedoe"); tester.controller().auditLogger().log((req3)); HttpRequest req4 = HttpRequest.createTestRequest( "http: com.yahoo.jdisc.http.HttpRequest.Method.POST ); req4.getJDiscRequest().setUserPrincipal(() -> "user.johndoe"); tester.controller().auditLogger().log((req4)); HttpRequest req5 = HttpRequest.createTestRequest( "http: com.yahoo.jdisc.http.HttpRequest.Method.PUT ); req5.getJDiscRequest().setUserPrincipal(() -> "user.johndoe"); tester.controller().auditLogger().log((req5)); HttpRequest req6 = HttpRequest.createTestRequest( "http: com.yahoo.jdisc.http.HttpRequest.Method.POST ); req6.getJDiscRequest().setUserPrincipal(() -> "user.janedoe"); tester.controller().auditLogger().log((req6)); metricsReporter.maintain(); assertEquals(2, getMetric(MetricsReporter.OPERATION_PREFIX + "zone", "user.janedoe")); assertEquals(2, getMetric(MetricsReporter.OPERATION_PREFIX + "routing", "user.johndoe")); assertEquals(1, getMetric(MetricsReporter.OPERATION_PREFIX + "zone", "user.johndoe")); assertEquals(1, getMetric(MetricsReporter.OPERATION_PREFIX + "routing", "user.janedoe")); }
@Override public boolean maintain() { reportDeploymentMetrics(); reportRemainingRotations(); reportQueuedNameServiceRequests(); reportInfrastructureUpgradeMetrics(); reportAuditLog(); return true; }
MetricsReporter extends ControllerMaintainer { @Override public boolean maintain() { reportDeploymentMetrics(); reportRemainingRotations(); reportQueuedNameServiceRequests(); reportInfrastructureUpgradeMetrics(); reportAuditLog(); return true; } }
MetricsReporter extends ControllerMaintainer { @Override public boolean maintain() { reportDeploymentMetrics(); reportRemainingRotations(); reportQueuedNameServiceRequests(); reportInfrastructureUpgradeMetrics(); reportAuditLog(); return true; } MetricsReporter(Controller controller, Metric metric); }
MetricsReporter extends ControllerMaintainer { @Override public boolean maintain() { reportDeploymentMetrics(); reportRemainingRotations(); reportQueuedNameServiceRequests(); reportInfrastructureUpgradeMetrics(); reportAuditLog(); return true; } MetricsReporter(Controller controller, Metric metric); @Override boolean maintain(); }
MetricsReporter extends ControllerMaintainer { @Override public boolean maintain() { reportDeploymentMetrics(); reportRemainingRotations(); reportQueuedNameServiceRequests(); reportInfrastructureUpgradeMetrics(); reportAuditLog(); return true; } MetricsReporter(Controller controller, Metric metric); @Override boolean maintain(); static final String DEPLOYMENT_FAIL_METRIC; static final String DEPLOYMENT_AVERAGE_DURATION; static final String DEPLOYMENT_FAILING_UPGRADES; static final String DEPLOYMENT_BUILD_AGE_SECONDS; static final String DEPLOYMENT_WARNINGS; static final String OS_CHANGE_DURATION; static final String PLATFORM_CHANGE_DURATION; static final String OS_NODE_COUNT; static final String PLATFORM_NODE_COUNT; static final String REMAINING_ROTATIONS; static final String NAME_SERVICE_REQUESTS_QUEUED; static final String OPERATION_PREFIX; }