@Test public void system_metrics_are_added() { VespaService service0 = testServices.get(0); Metrics oldSystemMetrics = service0.getSystemMetrics(); service0.getSystemMetrics().add(new Metric("cpu", 1)); List<MetricsPacket> packets = metricsManager.getMetrics(testServices, Instant.EPOCH); assertEquals(3, packets.size()); MetricsPacket systemPacket = packets.get(0); assertThat(systemPacket.metrics().get(toMetricId("cpu")), is(1.0)); assertThat(systemPacket.dimensions().get(toDimensionId("metrictype")), is("system")); service0.setSystemMetrics(oldSystemMetrics); }
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();  }