com.netflix.spectator.api.Registry.longTaskTimer()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中com.netflix.spectator.api.Registry.longTaskTimer方法的一些代码示例,展示了Registry.longTaskTimer的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.longTaskTimer方法的具体详情如下:
包路径:com.netflix.spectator.api.Registry
类名称:Registry
方法名:longTaskTimer

Registry.longTaskTimer介绍

[英]Measures the time taken for long tasks.
[中]测量长任务所需的时间。

代码示例

代码示例来源:origin: Netflix/spectator

/**
 * 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));
}

代码示例来源:origin: Netflix/spectator

/**
 * 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));
}

代码示例来源:origin: com.netflix.spectator/spectator-api

/**
 * 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));
}

代码示例来源:origin: com.netflix.spectator/spectator-api

/**
 * 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));
}

代码示例来源:origin: Netflix/spectator

/**
 * 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)));
}

代码示例来源:origin: com.netflix.spectator/spectator-api

/**
 * 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)));
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

@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);
 }
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-core

@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);
 }
}

代码示例来源:origin: Netflix/spectator

@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);
}

相关文章