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

x33g5p2x  于2022-01-28 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(154)

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

Registry.iterator介绍

[英]Iterator for traversing the set of meters in the registry.
[中]用于遍历注册表中的米集的迭代器。

代码示例

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

@Override public Iterator<Meter> iterator() {
 return impl.iterator();
}

代码示例来源:origin: org.springframework.metrics/spring-metrics

@Override
public Iterator<Meter> iterator() {
  return composite.iterator();
}

代码示例来源:origin: com.netflix.spectator/spectator-api

@Override public Iterator<Meter> iterator() {
 return impl.iterator();
}

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

@Test
public void testIteratorDoesNotAllowRemove() {
 Assertions.assertThrows(UnsupportedOperationException.class, () -> {
  Registry r = newRegistry(5, true);
  Iterator<Meter> iter = r.iterator();
  iter.remove();
 });
}

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

@Test
public void testMetricCollection() {
 execRequest("http://foo", 200);
 //then
 List<Meter> allMetrics = new ArrayList<>();
 registry.iterator().forEachRemaining(allMetrics::add);
 assertEquals(2, allMetrics.size());
 Optional<Timer> expectedTimer = registry.timers().findFirst();
 assertTrue(expectedTimer.isPresent());
 Timer timer = expectedTimer.get();
 assertEquals(1, timer.count());
 assertEquals(100000, timer.totalTime());
 Optional<Counter> expectedCounter = registry.counters().findFirst();
 assertTrue(expectedCounter.isPresent());
 assertEquals(12345L, expectedCounter.get().count());
}

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

@Test
public void testMetricCollection() {
 execRequest("http://foo", 200);
 //then
 List<Meter> allMetrics = new ArrayList<>();
 registry.iterator().forEachRemaining(allMetrics::add);
 assertEquals(2, allMetrics.size());
 Optional<Timer> expectedTimer = registry.timers().findFirst();
 assertTrue(expectedTimer.isPresent());
 Timer timer = expectedTimer.get();
 assertEquals(1, timer.count());
 assertEquals(100000, timer.totalTime());
 Optional<Counter> expectedCounter = registry.counters().findFirst();
 assertTrue(expectedCounter.isPresent());
 assertEquals(12345L, expectedCounter.get().count());
}

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

@Test
public void testIteratorNoRegistries() {
 Registry r = newRegistry(0, true);
 r.counter(r.createId("foo")).increment();
 Assertions.assertFalse(r.iterator().hasNext());
}

相关文章