本文整理了Java中com.netflix.spectator.api.Gauge.id()
方法的一些代码示例,展示了Gauge.id()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gauge.id()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Gauge
类名称:Gauge
方法名:id
暂无
代码示例来源:origin: Netflix/servo
@Override public Id id() {
return get().id();
}
代码示例来源:origin: Netflix/spectator
@Override protected Id id() {
return gauge.id();
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override protected Id id() {
return gauge.id();
}
代码示例来源:origin: org.springframework.metrics/spring-metrics
@Override
public String getName() {
return gauge.id().name();
}
代码示例来源:origin: com.netflix.servo/servo-core
@Override public Id id() {
return get().id();
}
代码示例来源:origin: Netflix/spectator
@Override protected void update(Registry registry) {
double sum = Double.NaN;
Iterator<ValueEntry<T>> iter = pairs.iterator();
while (iter.hasNext()) {
final ValueEntry<T> pair = iter.next();
final T obj = pair.ref.get();
if (obj != null) {
double v = pair.f.applyAsDouble(obj);
if (!Double.isNaN(v)) {
sum = Double.isNaN(sum) ? v : sum + v;
}
} else {
iter.remove();
}
}
if (pairs.isEmpty()) {
LOGGER.trace("gauge [{}] has expired", gauge.id());
}
LOGGER.trace("setting gauge [{}] to {}", gauge.id(), sum);
gauge.set(sum);
}
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override protected void update(Registry registry) {
double sum = Double.NaN;
Iterator<ValueEntry<T>> iter = pairs.iterator();
while (iter.hasNext()) {
final ValueEntry<T> pair = iter.next();
final T obj = pair.ref.get();
if (obj != null) {
double v = pair.f.applyAsDouble(obj);
if (!Double.isNaN(v)) {
sum = Double.isNaN(sum) ? v : sum + v;
}
} else {
iter.remove();
}
}
if (pairs.isEmpty()) {
LOGGER.trace("gauge [{}] has expired", gauge.id());
}
LOGGER.trace("setting gauge [{}] to {}", gauge.id(), sum);
gauge.set(sum);
}
}
代码示例来源:origin: Netflix/spectator
@Test
public void testIncrement() {
String[] tagValue = new String[] { "default" };
Gauge g = factory.gauge(factory.createId("testIncrement",
Collections.singleton(new TestTagFactory(tagValue))));
Assertions.assertEquals(Double.NaN, g.value(), 1e-12);
Assertions.assertEquals("testIncrement:tag=default", g.id().toString());
g.set(1);
Assertions.assertEquals(1.0, g.value(), 1e-12);
g.set(3);
Assertions.assertEquals(3.0, g.value(), 1e-12);
tagValue[0] = "value2";
Assertions.assertEquals("testIncrement:tag=value2", g.id().toString());
g.set(1);
Assertions.assertEquals(1.0, g.value(), 1e-12);
tagValue[0] = "default";
Assertions.assertEquals("testIncrement:tag=default", g.id().toString());
g.set(4);
Assertions.assertEquals(4.0, g.value(), 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);
}
内容来源于网络,如有侵权,请联系作者删除!