本文整理了Java中com.netflix.spectator.api.Counter.add()
方法的一些代码示例,展示了Counter.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.add()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Counter
类名称:Counter
方法名:add
[英]Update the counter by the specified amount.
[中]按指定的金额更新计数器。
代码示例来源:origin: Netflix/servo
@Override public void add(double amount) {
get().add(amount);
}
代码示例来源:origin: Netflix/spectator
/**
* Update the counter by {@code amount}.
*
* @param amount
* Amount to add to the counter.
*/
default void increment(long amount) {
add(amount);
}
代码示例来源:origin: Netflix/spectator
@Override public void add(double amount) {
for (Counter c : meters) {
c.add(amount);
}
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Update the counter by {@code amount}.
*
* @param amount
* Amount to add to the counter.
*/
default void increment(long amount) {
add(amount);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override public void add(double amount) {
for (Counter c : meters) {
c.add(amount);
}
}
代码示例来源:origin: Netflix/spectator
/** Update the counter by one. */
default void increment() {
add(1.0);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/** Update the counter by one. */
default void increment() {
add(1.0);
}
代码示例来源:origin: Netflix/spectator
@Override public void add(double amount) {
counter.add(amount);
lastUpdated.set(clock.wallTime());
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override public void add(double amount) {
counter.add(amount);
lastUpdated.set(clock.wallTime());
}
代码示例来源:origin: Netflix/spectator
@Override public void add(double amount) {
get().add(amount);
}
代码示例来源:origin: Netflix/spectator
@Override public void add(double amount) {
resolveToCurrentMeter().add(amount);
}
代码示例来源:origin: com.netflix.servo/servo-core
@Override public void add(double amount) {
get().add(amount);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override public void add(double amount) {
get().add(amount);
}
代码示例来源:origin: Netflix/spectator
@Test
public void testAddNaN() {
Counter c = new DefaultCounter(clock, NoopId.INSTANCE);
c.add(1.0);
c.add(Double.NaN);
Assertions.assertEquals(c.actualCount(), 1.0, 1e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void testAddInfinity() {
Counter c = new DefaultCounter(clock, NoopId.INSTANCE);
c.add(Double.POSITIVE_INFINITY);
Assertions.assertEquals(c.actualCount(), 0.0, 1e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void testAddNegativeAmount() {
Counter c = new DefaultCounter(clock, NoopId.INSTANCE);
c.add(-42.0);
Assertions.assertEquals(c.actualCount(), 0.0, 1e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void testAddAmount() {
Counter c = new DefaultCounter(clock, NoopId.INSTANCE);
c.add(42.0);
Assertions.assertEquals(c.actualCount(), 42.0, 1e-12);
}
代码示例来源:origin: Netflix/spectator
@Test
public void counterAdd() {
Counter c = registry.counter("foo");
Assertions.assertEquals(0.0, c.actualCount(), 1e-12);
c.add(1.5);
Assertions.assertEquals(1.5, c.actualCount(), 1e-12);
}
内容来源于网络,如有侵权,请联系作者删除!