本文整理了Java中com.netflix.spectator.api.Gauge.measure()
方法的一些代码示例,展示了Gauge.measure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gauge.measure()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Gauge
类名称:Gauge
方法名:measure
暂无
代码示例来源:origin: Netflix/servo
@Override public Iterable<Measurement> measure() {
return get().measure();
}
代码示例来源:origin: com.netflix.servo/servo-core
@Override public Iterable<Measurement> measure() {
return get().measure();
}
代码示例来源:origin: Netflix/spectator
private void assertLongTaskTimer(Registry r, Id id, long timestamp, int activeTasks, double duration) {
PolledMeter.update(r);
Gauge g = r.gauge(id.withTag(Statistic.activeTasks));
Assertions.assertEquals(timestamp, g.measure().iterator().next().timestamp());
Assertions.assertEquals(activeTasks, g.value(), 1.0e-12);
g = r.gauge(id.withTag(Statistic.duration));
Assertions.assertEquals(timestamp, g.measure().iterator().next().timestamp());
Assertions.assertEquals(duration, g.value(), 1.0e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void measure() {
final ServoRegistry r = new ServoRegistry(clock);
Gauge g = r.gauge(r.createId("foo"));
g.set(1.0);
Iterator<Measurement> ms = g.measure().iterator();
Assertions.assertTrue(ms.hasNext());
Measurement m = ms.next();
Assertions.assertFalse(ms.hasNext());
Assertions.assertEquals("foo", m.id().name());
Assertions.assertEquals(1.0, 1.0, 1e-12);
}
代码示例来源:origin: Netflix/spectator
private void doMeasurementTest(Gauge g, int expectedValue, long expectedTime) {
g.set(expectedValue);
clock.setWallTime(expectedTime);
List<Measurement> measurements = Utils.toList(g.measure());
Assertions.assertEquals(1, measurements.size());
Measurement m = measurements.get(0);
Assertions.assertEquals(g.id(), m.id());
Assertions.assertEquals(expectedTime, m.timestamp());
Assertions.assertEquals(expectedValue, m.value(), 0.1e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void gaugeMeasure() {
Gauge g = registry.gauge("foo");
g.set(42.0);
int i = 0;
for (Measurement m : g.measure()) {
++i;
Assertions.assertEquals("foo", m.id().name());
Assertions.assertEquals(42.0, m.value(), 1e-12);
}
Assertions.assertEquals(1, i);
}
内容来源于网络,如有侵权,请联系作者删除!