public LatencyMeasurement startServiceModelSnapshotLatencyMeasurement() {
        Consumer<Double> atCompletion = elapsedSeconds ->
                setValue(metricKey("snapshot.latency"), elapsedSeconds);
        return new LatencyMeasurement(timer, atCompletion).start();
    }
@Test
    public void testTryWithResources() {
        Metric metric = mock(Metric.class);
        Timer timer = mock(Timer.class);
        ServiceMonitorMetrics metrics = new ServiceMonitorMetrics(metric, timer);

        when(timer.currentTimeMillis()).thenReturn(Long.valueOf(500), Long.valueOf(1000));

        try (LatencyMeasurement measurement = metrics.startServiceModelSnapshotLatencyMeasurement()) {
            measurement.hashCode();
        }

        verify(metric).set("serviceModel.snapshot.latency", 0.5, null);
    }