本文整理了Java中com.netflix.spectator.api.Registry.maxGauge
方法的一些代码示例,展示了Registry.maxGauge
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.maxGauge
方法的具体详情如下:
包路径:com.netflix.spectator.api.Registry
类名称:Registry
方法名:maxGauge
[英]Measures the maximum value recorded since the last reset.
[中]测量自上次重置以来记录的最大值。
代码示例来源:origin: Netflix/servo
@Test
public void testDoubleMaxGauge() {
DoubleGauge c = new DoubleGauge(CONFIG);
register(c);
c.set(42.0);
assertEquals(42.0, registry.maxGauge(ID).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testUnregisteredBasicTimerIncrement() {
BasicTimer t = new BasicTimer(CONFIG);
t.record(42, TimeUnit.MILLISECONDS);
Id id = registry.createId("test")
.withTag("unit", "MILLISECONDS");
assertEquals(3, registry.counters().count());
assertEquals(0, registry.timers().count());
assertEquals(1, registry.gauges().count());
assertEquals(0, registry.distributionSummaries().count());
assertEquals(1, registry.counter(id.withTag(Statistic.count)).count());
assertEquals(42, registry.counter(id.withTag(Statistic.totalTime)).count());
assertEquals(42 * 42, registry.counter(id.withTag(Statistic.totalOfSquares)).count());
assertEquals(42.0, registry.maxGauge(id.withTag(Statistic.max)).value());
}
代码示例来源:origin: Netflix/servo
@Test
public void testBasicDistributionSummaryRecord() {
BasicDistributionSummary d = new BasicDistributionSummary(CONFIG);
register(d);
d.record(42);
assertEquals(1, registry.counter(ID.withTag(Statistic.count)).count());
assertEquals(42, registry.counter(ID.withTag(Statistic.totalAmount)).count());
assertEquals(42.0, registry.maxGauge(ID.withTag(Statistic.max)).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testDynamicTimerRecordSeconds() {
DynamicTimer.record(CONFIG, 42);
Id id = ID.withTag("unit", "MILLISECONDS");
assertEquals(1, registry.counter(id.withTag(Statistic.count)).count());
assertEquals(42, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12);
assertEquals(42 * 42, registry.counter(id.withTag(Statistic.totalOfSquares)).actualCount(), 1e-12);
assertEquals(42, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testBasicTimerRecordMillis() {
BasicTimer d = new BasicTimer(CONFIG);
register(d);
d.record(42, TimeUnit.NANOSECONDS);
Id id = ID.withTag("unit", "MILLISECONDS");
assertEquals(1, registry.counter(id.withTag(Statistic.count)).count());
assertEquals(42e-6, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12);
assertEquals(42e-6 * 42e-6, registry.counter(id.withTag(Statistic.totalOfSquares)).actualCount(), 1e-12);
assertEquals(42e-6, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testBasicTimerRecordSeconds() {
BasicTimer d = new BasicTimer(CONFIG, TimeUnit.SECONDS);
register(d);
d.record(42, TimeUnit.NANOSECONDS);
Id id = ID.withTag("unit", "SECONDS");
assertEquals(1, registry.counter(id.withTag(Statistic.count)).count());
assertEquals(42e-9, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12);
assertEquals(42e-9 * 42e-9, registry.counter(id.withTag(Statistic.totalOfSquares)).actualCount(), 1e-12);
assertEquals(42e-9, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testContextualTimerRecordMillis() {
TagList context = BasicTagList.of("a", "1");
ContextualTimer d = new ContextualTimer(CONFIG, () -> context, BasicTimer::new);
d.record(42, TimeUnit.NANOSECONDS);
Id id = ID.withTag("unit", "MILLISECONDS").withTag("a", "1");
assertEquals(1, registry.counter(id.withTag(Statistic.count)).count());
assertEquals(42e-6, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12);
assertEquals(42e-6 * 42e-6, registry.counter(id.withTag(Statistic.totalOfSquares)).actualCount(), 1e-12);
assertEquals(42e-6, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testBucketTimerRecordMillis() {
BucketConfig bc = new BucketConfig.Builder()
.withBuckets(new long[] {10L, 50L})
.withTimeUnit(TimeUnit.MILLISECONDS)
.build();
BucketTimer d = new BucketTimer(CONFIG, bc);
register(d);
d.record(42, TimeUnit.MILLISECONDS);
Id id = ID.withTag("unit", "MILLISECONDS");
assertEquals(1, registry.counter(id.withTag(Statistic.count).withTag("servo.bucket", "bucket=50ms")).count());
assertEquals(42.0, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12);
assertEquals(42.0, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12);
}
代码示例来源:origin: Netflix/servo
@Test
public void testStatsTimerRecordMillis() {
StatsConfig sc = new StatsConfig.Builder()
.withPercentiles(new double[] {50.0, 95.0})
.withPublishCount(true)
.withPublishMax(true)
.withPublishMean(true)
.withSampleSize(10)
.build();
StatsTimer d = new StatsTimer(CONFIG, sc);
register(d);
d.record(42, TimeUnit.MILLISECONDS);
d.computeStats();
Id id = ID.withTag("unit", "MILLISECONDS");
assertEquals(1, registry.counter(id.withTag(Statistic.count)).count());
assertEquals(42.0, registry.counter(id.withTag(Statistic.totalTime)).actualCount(), 1e-12);
assertEquals(42.0, registry.maxGauge(id.withTag(Statistic.max)).value(), 1e-12);
assertEquals(42.0, registry.gauge(id.withTag("statistic", "percentile_50")).value(), 1e-12);
assertEquals(42.0, registry.gauge(id.withTag("statistic", "percentile_95")).value(), 1e-12);
assertEquals(42.0, registry.gauge(id.withTag("statistic", "avg")).value(), 1e-12);
}
代码示例来源:origin: Netflix/spectator
@Override public Gauge lookup() {
return registry.maxGauge(id);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override public Gauge maxGauge(Id id) {
return impl.maxGauge(id);
}
代码示例来源:origin: Netflix/spectator
@Override public Gauge maxGauge(Id id) {
return impl.maxGauge(id);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
@Override public Gauge lookup() {
return registry.maxGauge(id);
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Measures the maximum value recorded since the last reset.
*
* @param name
* Description of the measurement that is being collected.
* @return
* Gauge instance with the corresponding id.
*/
default Gauge maxGauge(String name) {
return maxGauge(createId(name));
}
代码示例来源:origin: Netflix/spectator
/**
* Measures the maximum value recorded since the last reset.
*
* @param name
* Description of the measurement that is being collected.
* @return
* Gauge instance with the corresponding id.
*/
default Gauge maxGauge(String name) {
return maxGauge(createId(name));
}
代码示例来源:origin: Netflix/spectator
/**
* Measures the maximum value recorded since the last reset.
*
* @param name
* Description of the measurement that is being collected.
* @param tags
* Other dimensions that can be used to classify the measurement.
* @return
* Gauge instance with the corresponding id.
*/
default Gauge maxGauge(String name, Iterable<Tag> tags) {
return maxGauge(createId(name, tags));
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Measures the maximum value recorded since the last reset.
*
* @param name
* Description of the measurement that is being collected.
* @param tags
* Other dimensions that can be used to classify the measurement.
* @return
* Gauge instance with the corresponding id.
*/
default Gauge maxGauge(String name, Iterable<Tag> tags) {
return maxGauge(createId(name, tags));
}
代码示例来源:origin: Netflix/spectator
/**
* Measures the maximum value recorded since the last reset.
*
* @param name
* Description of the measurement that is being collected.
* @param tags
* Other dimensions that can be used to classify the measurement.
* @return
* Gauge instance with the corresponding id.
*/
default Gauge maxGauge(String name, String... tags) {
return maxGauge(createId(name, Utils.toIterable(tags)));
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Measures the maximum value recorded since the last reset.
*
* @param name
* Description of the measurement that is being collected.
* @param tags
* Other dimensions that can be used to classify the measurement.
* @return
* Gauge instance with the corresponding id.
*/
default Gauge maxGauge(String name, String... tags) {
return maxGauge(createId(name, Utils.toIterable(tags)));
}
代码示例来源:origin: Netflix/spectator
@Test
public void maxGauge() {
Registry r = newRegistry(true, 10000);
r.maxGauge("foo").set(1.0);
r.maxGauge("foo").set(3.0);
r.maxGauge("foo").set(2.0);
final DoubleSummaryStatistics valueSummary = r.gauges()
.filter(Functions.nameEquals("foo"))
.collect(Collectors.summarizingDouble(Gauge::value));
Assertions.assertEquals(1, valueSummary.getCount());
Assertions.assertEquals(3.0, valueSummary.getSum(), 1e-12);
}
内容来源于网络,如有侵权,请联系作者删除!