Search in sources :

Example 1 with MapContext

use of com.yahoo.vespa.hosted.controller.MetricsMock.MapContext in project vespa by vespa-engine.

the class MetricsReporterTest method test_chef_metrics.

@Test
public void test_chef_metrics() {
    Clock clock = Clock.fixed(Instant.ofEpochSecond(1475497913), ZoneId.systemDefault());
    ;
    ControllerTester tester = new ControllerTester();
    MetricsReporter metricsReporter = createReporter(clock, tester.controller(), metrics, SystemName.cd);
    metricsReporter.maintain();
    assertEquals(2, metrics.getMetrics().size());
    Map<MapContext, Map<String, Number>> hostMetrics = getMetricsByHost("fake-node.test");
    assertEquals(1, hostMetrics.size());
    Map.Entry<MapContext, Map<String, Number>> metricEntry = hostMetrics.entrySet().iterator().next();
    MapContext metricContext = metricEntry.getKey();
    assertDimension(metricContext, "tenantName", "ciintegrationtests");
    assertDimension(metricContext, "app", "restart.default");
    assertDimension(metricContext, "zone", "prod.cd-us-east-1");
    assertEquals(727, metricEntry.getValue().get(MetricsReporter.convergeMetric).longValue());
}
Also used : MapContext(com.yahoo.vespa.hosted.controller.MetricsMock.MapContext) Clock(java.time.Clock) Map(java.util.Map) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Example 2 with MapContext

use of com.yahoo.vespa.hosted.controller.MetricsMock.MapContext in project vespa by vespa-engine.

the class MetricsReporterTest method it_omits_zone_when_unknown.

@Test
public void it_omits_zone_when_unknown() {
    ControllerTester tester = new ControllerTester();
    String hostname = "fake-node2.test";
    MapContext metricContext = getMetricContextByHost(tester.controller(), hostname);
    assertNull(metricContext.getDimensions().get("zone"));
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) MapContext(com.yahoo.vespa.hosted.controller.MetricsMock.MapContext) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Aggregations

ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)2 MapContext (com.yahoo.vespa.hosted.controller.MetricsMock.MapContext)2 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)2 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)2 Test (org.junit.Test)2 Clock (java.time.Clock)1 Map (java.util.Map)1 Matchers.anyString (org.mockito.Matchers.anyString)1