本文整理了Java中com.netflix.spectator.api.Timer.id()
方法的一些代码示例,展示了Timer.id()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Timer.id()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Timer
类名称:Timer
方法名:id
暂无
代码示例来源:origin: Netflix/servo
@Override public Id id() {
return get().id();
}
代码示例来源:origin: com.netflix.servo/servo-core
@Override public Id id() {
return get().id();
}
代码示例来源:origin: org.springframework.metrics/spring-metrics
SpectatorTimer(com.netflix.spectator.api.Timer timer, Clock clock) {
super(new MeterId(timer.id().name(), SpectatorUtils.tags(timer)), clock);
this.timer = timer;
}
代码示例来源:origin: Netflix/spectator
@Test
public void testRecord() {
String[] tagValue = new String[] { "default" };
Timer timer = factory.timer(factory.createId("testRecord",
Collections.singleton(new TestTagFactory(tagValue))));
timer.record(42, TimeUnit.MILLISECONDS);
Assertions.assertEquals("testRecord:tag=default", timer.id().toString());
Assertions.assertEquals(timer.count(), 1L);
Assertions.assertEquals(42000000L, timer.totalTime());
tagValue[0] = "value2";
Assertions.assertEquals("testRecord:tag=value2", timer.id().toString());
Assertions.assertEquals(0L, timer.count());
Assertions.assertEquals(0L, timer.totalTime());
}
代码示例来源:origin: Netflix/spectator
@Test
public void testMeasure() {
Timer t = newTimer();
t.record(42, TimeUnit.MILLISECONDS);
clock.setWallTime(3712345L);
for (Measurement m : t.measure()) {
Assertions.assertEquals(m.timestamp(), 3712345L);
if (m.id().equals(t.id().withTag(Statistic.count))) {
Assertions.assertEquals(m.value(), 1.0, 0.1e-12);
} else if (m.id().equals(t.id().withTag(Statistic.totalTime))) {
Assertions.assertEquals(m.value(), 42e6, 0.1e-12);
} else {
Assertions.fail("unexpected id: " + m.id());
}
}
}
}
代码示例来源:origin: Netflix/spectator
@Test
public void testMeasure() {
Timer timer = factory.timer(factory.createId("testMeasure"));
timer.record(42, TimeUnit.MILLISECONDS);
clock.setWallTime(3712345L);
for (Measurement m : timer.measure()) {
Assertions.assertEquals(m.timestamp(), 3712345L);
if (m.id().equals(timer.id().withTag(Statistic.count))) {
Assertions.assertEquals(1.0, m.value(), 0.1e-12);
} else if (m.id().equals(timer.id().withTag(Statistic.totalTime))) {
Assertions.assertEquals(42e6, m.value(), 0.1e-12);
} else {
Assertions.fail("unexpected id: " + m.id());
}
}
}
}
代码示例来源:origin: Netflix/spectator
@Test
public void testMeasure() {
Timer t = new DefaultTimer(clock, new DefaultId("foo"));
t.record(42, TimeUnit.MILLISECONDS);
clock.setWallTime(3712345L);
for (Measurement m : t.measure()) {
Assertions.assertEquals(m.timestamp(), 3712345L);
if (m.id().equals(t.id().withTag(Statistic.count))) {
Assertions.assertEquals(m.value(), 1.0, 0.1e-12);
} else if (m.id().equals(t.id().withTag(Statistic.totalTime))) {
Assertions.assertEquals(m.value(), 42e6, 0.1e-12);
} else {
Assertions.fail("unexpected id: " + m.id());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!