com.netflix.spectator.api.Counter.measure()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中com.netflix.spectator.api.Counter.measure()方法的一些代码示例,展示了Counter.measure()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.measure()方法的具体详情如下:
包路径:com.netflix.spectator.api.Counter
类名称:Counter
方法名:measure

Counter.measure介绍

暂无

代码示例

代码示例来源:origin: Netflix/servo

  1. @Override public Iterable<Measurement> measure() {
  2. return get().measure();
  3. }

代码示例来源:origin: Netflix/spectator

  1. @Override public Iterable<Measurement> measure() {
  2. List<Measurement> ms = new ArrayList<>();
  3. for (Measurement m : count.measure()) {
  4. ms.add(m);
  5. }
  6. for (Measurement m : totalAmount.measure()) {
  7. ms.add(m);
  8. }
  9. return ms;
  10. }

代码示例来源:origin: com.netflix.servo/servo-core

  1. @Override public Iterable<Measurement> measure() {
  2. return get().measure();
  3. }

代码示例来源:origin: Netflix/spectator

  1. @Test
  2. public void testGet() {
  3. Registry r = newRegistry(5, true);
  4. Counter c = r.counter(r.createId("foo"));
  5. c.increment(42);
  6. Meter m = r.get(c.id());
  7. Assertions.assertEquals(c.measure().iterator().next(), m.measure().iterator().next());
  8. }

代码示例来源:origin: Netflix/spectator

  1. private void doMeasurementTest(Counter c, int expectedValue, long expectedTime) {
  2. c.increment(expectedValue);
  3. clock.setWallTime(expectedTime);
  4. List<Measurement> measurements = Utils.toList(c.measure());
  5. Assertions.assertEquals(1, measurements.size());
  6. Measurement m = measurements.get(0);
  7. Assertions.assertEquals(c.id(), m.id());
  8. Assertions.assertEquals(expectedTime, m.timestamp());
  9. Assertions.assertEquals(expectedValue, m.value(), 0.1e-12);
  10. }

代码示例来源:origin: Netflix/spectator

  1. @Test
  2. public void counterMeasure() {
  3. Counter c = registry.counter("foo");
  4. c.increment();
  5. int i = 0;
  6. for (Measurement m : c.measure()) {
  7. ++i;
  8. Assertions.assertEquals("foo", m.id().name());
  9. Assertions.assertEquals(1.0, m.value(), 1e-12);
  10. }
  11. Assertions.assertEquals(1, i);
  12. }

代码示例来源:origin: Netflix/spectator

  1. @Test
  2. public void testMeasure() {
  3. Counter c = new DefaultCounter(clock, NoopId.INSTANCE);
  4. c.increment(42);
  5. clock.setWallTime(3712345L);
  6. for (Measurement m : c.measure()) {
  7. Assertions.assertEquals(m.id(), c.id());
  8. Assertions.assertEquals(m.timestamp(), 3712345L);
  9. Assertions.assertEquals(m.value(), 42.0, 0.1e-12);
  10. }
  11. }

代码示例来源:origin: Netflix/spectator

  1. @Test
  2. public void measure() {
  3. Counter c = newCounter();
  4. c.increment(42);
  5. clock.setWallTime(3712345L);
  6. for (Measurement m : c.measure()) {
  7. Assertions.assertEquals(m.id(), c.id());
  8. Assertions.assertEquals(m.timestamp(), 3712345L);
  9. Assertions.assertEquals(m.value(), 42.0, 0.1e-12);
  10. }
  11. }

相关文章