本文整理了Java中com.netflix.spectator.api.Counter.measure()
方法的一些代码示例,展示了Counter.measure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.measure()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Counter
类名称:Counter
方法名:measure
暂无
代码示例来源:origin: Netflix/servo
@Override public Iterable<Measurement> measure() {
return get().measure();
}
代码示例来源:origin: Netflix/spectator
@Override public Iterable<Measurement> measure() {
List<Measurement> ms = new ArrayList<>();
for (Measurement m : count.measure()) {
ms.add(m);
}
for (Measurement m : totalAmount.measure()) {
ms.add(m);
}
return ms;
}
代码示例来源:origin: com.netflix.servo/servo-core
@Override public Iterable<Measurement> measure() {
return get().measure();
}
代码示例来源:origin: Netflix/spectator
@Test
public void testGet() {
Registry r = newRegistry(5, true);
Counter c = r.counter(r.createId("foo"));
c.increment(42);
Meter m = r.get(c.id());
Assertions.assertEquals(c.measure().iterator().next(), m.measure().iterator().next());
}
代码示例来源:origin: Netflix/spectator
private void doMeasurementTest(Counter c, int expectedValue, long expectedTime) {
c.increment(expectedValue);
clock.setWallTime(expectedTime);
List<Measurement> measurements = Utils.toList(c.measure());
Assertions.assertEquals(1, measurements.size());
Measurement m = measurements.get(0);
Assertions.assertEquals(c.id(), m.id());
Assertions.assertEquals(expectedTime, m.timestamp());
Assertions.assertEquals(expectedValue, m.value(), 0.1e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void counterMeasure() {
Counter c = registry.counter("foo");
c.increment();
int i = 0;
for (Measurement m : c.measure()) {
++i;
Assertions.assertEquals("foo", m.id().name());
Assertions.assertEquals(1.0, m.value(), 1e-12);
}
Assertions.assertEquals(1, i);
}
代码示例来源:origin: Netflix/spectator
@Test
public void testMeasure() {
Counter c = new DefaultCounter(clock, NoopId.INSTANCE);
c.increment(42);
clock.setWallTime(3712345L);
for (Measurement m : c.measure()) {
Assertions.assertEquals(m.id(), c.id());
Assertions.assertEquals(m.timestamp(), 3712345L);
Assertions.assertEquals(m.value(), 42.0, 0.1e-12);
}
}
代码示例来源:origin: Netflix/spectator
@Test
public void measure() {
Counter c = newCounter();
c.increment(42);
clock.setWallTime(3712345L);
for (Measurement m : c.measure()) {
Assertions.assertEquals(m.id(), c.id());
Assertions.assertEquals(m.timestamp(), 3712345L);
Assertions.assertEquals(m.value(), 42.0, 0.1e-12);
}
}
内容来源于网络,如有侵权,请联系作者删除!