Java Code Examples for com.linecorp.armeria.common.metric.MoreMeters#measureAll()
The following examples show how to use
com.linecorp.armeria.common.metric.MoreMeters#measureAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZooKeeperCommandExecutorTest.java From centraldogma with Apache License 2.0 | 5 votes |
@Test void metrics() throws Exception { final List<Replica> cluster = buildCluster(1, true /* start */, ZooKeeperCommandExecutorTest::newMockDelegate); try { final Map<String, Double> meters = MoreMeters.measureAll(cluster.get(0).meterRegistry); meters.forEach((k, v) -> logger.debug("{}={}", k, v)); assertThat(meters).containsKeys("executor#total{name=zkCommandExecutor}", "executor#total{name=zkLeaderSelector}", "executor#total{name=zkLogWatcher}", "executor.pool.size#value{name=zkCommandExecutor}", "executor.pool.size#value{name=zkLeaderSelector}", "executor.pool.size#value{name=zkLogWatcher}", "replica.has.leadership#value", "replica.id#value", "replica.last.replayed.revision#value", "replica.read.only#value", "replica.replicating#value", "replica.zk.alive.client.connections#value", "replica.zk.approximate.data.size#value", "replica.zk.data.dir.size#value", "replica.zk.ephemerals#value", "replica.zk.state#value", "replica.zk.last.processed.zxid#value", "replica.zk.latency#value{type=avg}", "replica.zk.latency#value{type=max}", "replica.zk.latency#value{type=min}", "replica.zk.log.dir.size#value", "replica.zk.nodes#value", "replica.zk.outstanding.requests#value", "replica.zk.packets.received#count", "replica.zk.packets.sent#count", "replica.zk.watches#value"); } finally { cluster.forEach(r -> r.rm.stop()); } }
Example 2
Source File: CachingRepositoryTest.java From centraldogma with Apache License 2.0 | 5 votes |
@Test void metrics() { final MeterRegistry meterRegistry = PrometheusMeterRegistries.newRegistry(); final Repository repo = newCachingRepo(meterRegistry); final Map<String, Double> meters = MoreMeters.measureAll(meterRegistry); assertThat(meters).containsKeys("cache.load#count{cache=repository,result=success}"); // Do something with 'repo' so that it is not garbage-collected even before the meters are measured. assertThat(repo.normalizeNow(HEAD)).isNotEqualTo(""); }
Example 3
Source File: ArmeriaMeterBindersConfigurationTest.java From armeria with Apache License 2.0 | 5 votes |
@Test public void testDefaultMetrics() throws Exception { final Map<String, Double> measurements = MoreMeters.measureAll(registry); assertThat(measurements).containsKeys( "jvm.buffer.count#value{id=direct}", "jvm.classes.loaded#value", "jvm.threads.daemon#value", "logback.events#count{level=debug}", "process.uptime#value", "system.cpu.count#value"); // Use prefix-matching for meter IDs because JVM memory meters differ between JVM versions. assertThat(measurements).hasKeySatisfying(new Condition<>( key -> key.startsWith("jvm.memory.max#value{area=nonheap,id="), "MeterRegistry must contain JVM memory meters")); final OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean(); boolean hasOpenFdCount = false; try { os.getClass().getDeclaredMethod("getOpenFileDescriptorCount"); hasOpenFdCount = true; } catch (Exception ignored) { // Not supported } if (hasOpenFdCount) { assertThat(measurements).containsKeys("process.files.open#value"); } }