org.rocksdb.TickerType Java Examples
The following examples show how to use
org.rocksdb.TickerType.
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: RocksDBStoreMBean.java From hadoop-ozone with Apache License 2.0 | 6 votes |
@Override public MBeanInfo getMBeanInfo() { List<MBeanAttributeInfo> attributes = new ArrayList<>(); for (TickerType tickerType : TickerType.values()) { attributes.add(new MBeanAttributeInfo(tickerType.name(), "long", "RocksDBStat: " + tickerType.name(), true, false, false)); } for (HistogramType histogramType : HistogramType.values()) { for (String histogramAttribute : histogramAttributes) { attributes.add(new MBeanAttributeInfo( histogramType.name() + "_" + histogramAttribute.toUpperCase(), "long", "RocksDBStat: " + histogramType.name(), true, false, false)); } } return new MBeanInfo("", "RocksDBStat", attributes.toArray(new MBeanAttributeInfo[0]), null, null, null); }
Example #2
Source File: RocksDBStats.java From besu with Apache License 2.0 | 6 votes |
public static void registerRocksDBMetrics( final Statistics stats, final PrometheusMetricsSystem metricsSystem, final MetricCategory category) { for (final TickerType ticker : TICKERS) { final String promCounterName = ticker.name().toLowerCase(); metricsSystem.createLongGauge( category, promCounterName, "RocksDB reported statistics for " + ticker.name(), () -> stats.getTickerCount(ticker)); } for (final HistogramType histogram : HISTOGRAMS) { metricsSystem.addCollector(category, histogramToCollector(stats, histogram)); } }
Example #3
Source File: RocksDbStats.java From teku with Apache License 2.0 | 6 votes |
public void registerMetrics() { for (final TickerType ticker : TICKERS) { final String promCounterName = ticker.name().toLowerCase(); metricsSystem.createLongGauge( category, promCounterName, "RocksDB reported statistics for " + ticker.name(), () -> ifOpen(() -> stats.getTickerCount(ticker), 0L)); } if (metricsSystem instanceof PrometheusMetricsSystem) { for (final HistogramType histogram : HISTOGRAMS) { ((PrometheusMetricsSystem) metricsSystem) .addCollector(category, histogramToCollector(category, stats, histogram)); } } }
Example #4
Source File: ByteStoreManager.java From dremio-oss with Apache License 2.0 | 6 votes |
private void registerMetrics(DBOptions dbOptions) { // calling DBOptions.statisticsPtr() will create a Statistics object that will collect various stats from RocksDB and // will introduce a 5-10% overhead if(!COLLECT_METRICS) { return; } final Statistics statistics = new Statistics(); statistics.setStatsLevel(StatsLevel.ALL); dbOptions.setStatistics(statistics); // for now, let's add all ticker stats as gauge metrics for (TickerType tickerType : TickerType.values()) { if (tickerType == TickerType.TICKER_ENUM_MAX) { continue; } Metrics.newGauge(Metrics.join(METRICS_PREFIX, tickerType.name()), () -> statistics.getTickerCount(tickerType)); } // Note that Statistics also contains various histogram metrics, but those cannot be easily tracked through our metrics }
Example #5
Source File: RocksDBStoreMBean.java From hadoop-ozone with Apache License 2.0 | 5 votes |
@Override public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { for (String histogramAttribute : histogramAttributes) { if (attribute.endsWith("_" + histogramAttribute.toUpperCase())) { String keyName = attribute .substring(0, attribute.length() - histogramAttribute.length() - 1); try { HistogramData histogram = statistics.getHistogramData(HistogramType.valueOf(keyName)); try { Method method = HistogramData.class.getMethod("get" + histogramAttribute); return method.invoke(histogram); } catch (Exception e) { throw new ReflectionException(e, "Can't read attribute " + attribute); } } catch (IllegalArgumentException exception) { throw new AttributeNotFoundException( "No such attribute in RocksDB stats: " + attribute); } } } try { return statistics.getTickerCount(TickerType.valueOf(attribute)); } catch (IllegalArgumentException ex) { throw new AttributeNotFoundException( "No such attribute in RocksDB stats: " + attribute); } }
Example #6
Source File: RocksDBStoreMBean.java From hadoop-ozone with Apache License 2.0 | 5 votes |
/** * Collect all Counter metrics from RocksDB statistics. * @param rb Metrics Record Builder. */ private void getTickerTypeData(MetricsRecordBuilder rb) { for (TickerType tickerType : TickerType.values()) { rb.addCounter(Interns.info(tickerType.name(), "RocksDBStat"), statistics.getTickerCount(tickerType)); } }
Example #7
Source File: RocksStatistics.java From sofa-jraft with Apache License 2.0 | 5 votes |
/** * Get the count for a ticker. */ public static long getTickerCount(final RocksRawKVStore rocksRawKVStore, final TickerType tickerType) { final Statistics statistics = statistics(rocksRawKVStore); if (statistics == null) { return -1L; } return statistics.getTickerCount(tickerType); }
Example #8
Source File: RocksStatistics.java From sofa-jraft with Apache License 2.0 | 5 votes |
/** * Get the count for a ticker and reset the tickers count. */ public static long getAndResetTickerCount(final RocksRawKVStore rocksRawKVStore, final TickerType tickerType) { final Statistics statistics = statistics(rocksRawKVStore); if (statistics == null) { return -1L; } return statistics.getAndResetTickerCount(tickerType); }