/** * Measures the time taken for long tasks. * * @param name * Description of the measurement that is being collected. * @return * Timer instance with the corresponding id. * @deprecated * Use {@link com.netflix.spectator.api.patterns.LongTaskTimer#get(Registry, Id)} * instead. Scheduled to be removed in 2.0. */ @Deprecated default LongTaskTimer longTaskTimer(String name) { return longTaskTimer(createId(name)); }
/** * Measures the time taken for long tasks. * * @param name * Description of the measurement that is being collected. * @param tags * Other dimensions that can be used to classify the measurement. * @return * Timer instance with the corresponding id. * @deprecated * Use {@link com.netflix.spectator.api.patterns.LongTaskTimer#get(Registry, Id)} * instead. Scheduled to be removed in 2.0. */ @Deprecated default LongTaskTimer longTaskTimer(String name, Iterable<Tag> tags) { return longTaskTimer(createId(name, tags)); }
/** * Measures the time taken for long tasks. * * @param name * Description of the measurement that is being collected. * @return * Timer instance with the corresponding id. * @deprecated * Use {@link com.netflix.spectator.api.patterns.LongTaskTimer#get(Registry, Id)} * instead. Scheduled to be removed in 2.0. */ @Deprecated default LongTaskTimer longTaskTimer(String name) { return longTaskTimer(createId(name)); }
/** * Measures the time taken for long tasks. * * @param name * Description of the measurement that is being collected. * @param tags * Other dimensions that can be used to classify the measurement. * @return * Timer instance with the corresponding id. * @deprecated * Use {@link com.netflix.spectator.api.patterns.LongTaskTimer#get(Registry, Id)} * instead. Scheduled to be removed in 2.0. */ @Deprecated default LongTaskTimer longTaskTimer(String name, Iterable<Tag> tags) { return longTaskTimer(createId(name, tags)); }
/** * Measures the time taken for long tasks. * * @param name * Description of the measurement that is being collected. * @param tags * Other dimensions that can be used to classify the measurement. * @return * Timer instance with the corresponding id. * @deprecated * Use {@link com.netflix.spectator.api.patterns.LongTaskTimer#get(Registry, Id)} * instead. Scheduled to be removed in 2.0. */ @Deprecated default LongTaskTimer longTaskTimer(String name, String... tags) { return longTaskTimer(createId(name, Utils.toIterable(tags))); }
/** * Measures the time taken for long tasks. * * @param name * Description of the measurement that is being collected. * @param tags * Other dimensions that can be used to classify the measurement. * @return * Timer instance with the corresponding id. * @deprecated * Use {@link com.netflix.spectator.api.patterns.LongTaskTimer#get(Registry, Id)} * instead. Scheduled to be removed in 2.0. */ @Deprecated default LongTaskTimer longTaskTimer(String name, String... tags) { return longTaskTimer(createId(name, Utils.toIterable(tags))); }
@Override protected void tick() { LongTaskTimer timer = registry.longTaskTimer(timerId); long timerId = timer.start(); try { executionRepository.retrieveAllApplicationNames(PIPELINE).forEach(app -> { log.debug("Cleaning up " + app); cleanupApp(executionRepository.retrievePipelinesForApplication(app)); }); } catch (Exception e) { log.error("Cleanup failed", e); } finally { timer.stop(timerId); } }
@VisibleForTesting protected void tick() { LongTaskTimer timer = registry.longTaskTimer(timerId); long timerId = timer.start(); log.info("Starting cleanup"); try { executionRepository.retrieveAllApplicationNames(ORCHESTRATION, threshold).forEach(app -> { log.info("Cleaning up orchestration executions (application: {}, threshold: {})", app, threshold); ExecutionCriteria executionCriteria = new ExecutionCriteria(); executionCriteria.setPageSize(Integer.MAX_VALUE); cleanup(executionRepository.retrieveOrchestrationsForApplication(app, executionCriteria), app, "orchestration"); }); } catch (Exception e) { log.error("Cleanup failed", e); } finally { timer.stop(timerId); } }
@Test public void testLongTaskTimerHelpers() { ManualClock clock = new ManualClock(); Registry r = new DefaultRegistry(clock); LongTaskTimer c1 = r.longTaskTimer("foo", "bar", "baz", "k", "v"); assertLongTaskTimer(r, c1.id(), 0L, 0, 0L); LongTaskTimer c2 = r.longTaskTimer("foo", ArrayTagSet.create("k", "v").add(new BasicTag("bar", "baz"))); Assertions.assertEquals(c1.id(), c2.id()); long t1 = c1.start(); long t2 = c2.start(); clock.setMonotonicTime(1000L); clock.setWallTime(1L); assertLongTaskTimer(r, c1.id(), 1L, 2, 2.0e-6); c1.stop(t1); assertLongTaskTimer(r, c1.id(), 1L, 1, 1.0e-6); c2.stop(t2); assertLongTaskTimer(r, c1.id(), 1L, 0, 0L); }