@Test public void service_that_is_down_has_a_separate_metrics_packet() { var downService = new DownService(HealthMetric.getDown("No response")); List<VespaService> testServices = Collections.singletonList(downService); MetricsManager metricsManager = TestUtil.createMetricsManager(new VespaServices(testServices), getMetricsConsumers(),getApplicationDimensions(), getNodeDimensions()); List<MetricsPacket> packets = metricsManager.getMetrics(testServices, Instant.EPOCH); assertThat(packets.size(), is(1)); assertTrue(packets.get(0).metrics().isEmpty()); assertThat(packets.get(0).dimensions().get(toDimensionId("instance")), is(DownService.NAME)); assertThat(packets.get(0).dimensions().get(toDimensionId("global")), is("value")); }
public List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime) { return getMetricsAsBuilders(services, startTime).stream() .map(MetricsPacket.Builder::build) .collect(Collectors.toList()); }
MetricsManager { public List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime) { return getMetricsAsBuilders(services, startTime).stream() .map(MetricsPacket.Builder::build) .collect(Collectors.toList()); } }
MetricsManager { public List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime) { return getMetricsAsBuilders(services, startTime).stream() .map(MetricsPacket.Builder::build) .collect(Collectors.toList()); } MetricsManager(VespaServices vespaServices,
                          VespaMetrics vespaMetrics,
                          ExternalMetrics externalMetrics,
                          ApplicationDimensions applicationDimensions,
                          NodeDimensions nodeDimensions); }
MetricsManager { public List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime) { return getMetricsAsBuilders(services, startTime).stream() .map(MetricsPacket.Builder::build) .collect(Collectors.toList()); } MetricsManager(VespaServices vespaServices,
                          VespaMetrics vespaMetrics,
                          ExternalMetrics externalMetrics,
                          ApplicationDimensions applicationDimensions,
                          NodeDimensions nodeDimensions); String getMetricNamesForServiceAndConsumer(String service, ConsumerId consumer); String getMetricsByConfigId(String configId); List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime); List<MetricsPacket.Builder> getMetricsAsBuilders(List<VespaService> services, Instant startTime); List<MetricsPacket> getHealthMetrics(List<VespaService> services); void setExtraMetrics(List<MetricsPacket.Builder> packets); Map<DimensionId, String> getExtraDimensions(); void purgeExtraMetrics(); String getAllVespaServices(); }
MetricsManager { public List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime) { return getMetricsAsBuilders(services, startTime).stream() .map(MetricsPacket.Builder::build) .collect(Collectors.toList()); } MetricsManager(VespaServices vespaServices,
                          VespaMetrics vespaMetrics,
                          ExternalMetrics externalMetrics,
                          ApplicationDimensions applicationDimensions,
                          NodeDimensions nodeDimensions); String getMetricNamesForServiceAndConsumer(String service, ConsumerId consumer); String getMetricsByConfigId(String configId); List<MetricsPacket> getMetrics(List<VespaService> services, Instant startTime); List<MetricsPacket.Builder> getMetricsAsBuilders(List<VespaService> services, Instant startTime); List<MetricsPacket> getHealthMetrics(List<VespaService> services); void setExtraMetrics(List<MetricsPacket.Builder> packets); Map<DimensionId, String> getExtraDimensions(); void purgeExtraMetrics(); String getAllVespaServices();  }