Java Code Examples for org.apache.hadoop.metrics2.MetricsSource#getMetrics()
The following examples show how to use
org.apache.hadoop.metrics2.MetricsSource#getMetrics() .
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: TestRocksDBStoreMBean.java From hadoop-ozone with Apache License 2.0 | 6 votes |
@Test public void testMetricsSystemIntegration() throws Exception { RocksDBStore metadataStore = getTestRocksDBStoreWithData(); Thread.sleep(2000); MetricsSystem ms = DefaultMetricsSystem.instance(); MetricsSource rdbSource = ms.getSource("Rocksdb_TestRocksDBStoreMBean-withstat"); BufferedMetricsCollector metricsCollector = new BufferedMetricsCollector(); rdbSource.getMetrics(metricsCollector, true); Map<String, Double> metrics = metricsCollector.getMetricsRecordBuilder() .getMetrics(); assertTrue(10.0 == metrics.get("NUMBER_KEYS_WRITTEN")); assertTrue(metrics.get("DB_WRITE_AVERAGE") > 0); metadataStore.close(); }
Example 2
Source File: MetricsAsserts.java From hadoop with Apache License 2.0 | 5 votes |
/** * Call getMetrics on source and get a record builder mock to verify * @param source the metrics source * @param all if true, return all metrics even if not changed * @return the record builder mock to verify */ public static MetricsRecordBuilder getMetrics(MetricsSource source, boolean all) { MetricsRecordBuilder rb = mockMetricsRecordBuilder(); MetricsCollector mc = rb.parent(); source.getMetrics(mc, all); return rb; }
Example 3
Source File: MetricsAsserts.java From big-c with Apache License 2.0 | 5 votes |
/** * Call getMetrics on source and get a record builder mock to verify * @param source the metrics source * @param all if true, return all metrics even if not changed * @return the record builder mock to verify */ public static MetricsRecordBuilder getMetrics(MetricsSource source, boolean all) { MetricsRecordBuilder rb = mockMetricsRecordBuilder(); MetricsCollector mc = rb.parent(); source.getMetrics(mc, all); return rb; }
Example 4
Source File: MetricsAssertHelperImpl.java From hbase with Apache License 2.0 | 5 votes |
private void getMetrics(BaseSource source) { reset(); if (!(source instanceof MetricsSource)) { assertTrue("The Source passed must be a MetricsSource", false); } MetricsSource impl = (MetricsSource) source; impl.getMetrics(new MockMetricsBuilder(), true); }