本文整理匯總了Java中com.thinkaurelius.titan.util.stats.MetricManager.INSTANCE屬性的典型用法代碼示例。如果您正苦於以下問題:Java MetricManager.INSTANCE屬性的具體用法?Java MetricManager.INSTANCE怎麽用?Java MetricManager.INSTANCE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.thinkaurelius.titan.util.stats.MetricManager
的用法示例。
在下文中一共展示了MetricManager.INSTANCE屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: runWithMetrics
static <T> T runWithMetrics(String prefix, String storeName, String name, IOCallable<T> impl) throws IOException {
if (null == prefix) {
return impl.call();
}
Preconditions.checkNotNull(name);
Preconditions.checkNotNull(impl);
final MetricManager mgr = MetricManager.INSTANCE;
mgr.getCounter(prefix, storeName, name, M_CALLS).inc();
final Timer.Context tc = mgr.getTimer(prefix, storeName, name, M_TIME).time();
try {
return impl.call();
} catch (IOException e) {
mgr.getCounter(prefix, storeName, name, M_EXCEPTIONS).inc();
throw e;
} finally {
tc.stop();
}
}
示例2: runWithMetrics
private <T> T runWithMetrics(String opName, Function<Void,T> impl) {
Preconditions.checkNotNull(opName);
Preconditions.checkNotNull(impl);
final MetricManager mgr = MetricManager.INSTANCE;
mgr.getCounter(metricsPrefix, opName, M_CALLS).inc();
final Timer.Context tc = mgr.getTimer(metricsPrefix, opName, M_TIME).time();
try {
return impl.apply(null);
} catch (RuntimeException e) {
mgr.getCounter(metricsPrefix, opName, M_EXCEPTIONS).inc();
throw e;
} finally {
tc.stop();
}
}
示例3: recordSliceMetrics
private void recordSliceMetrics(StoreTransaction txh, List<Entry> row) {
if (!txh.getConfiguration().hasGroupName())
return;
String p = txh.getConfiguration().getGroupName();
final MetricManager mgr = MetricManager.INSTANCE;
mgr.getCounter(p, metricsStoreName, M_GET_SLICE, M_ENTRIES_COUNT).inc(row.size());
mgr.getHistogram(p, metricsStoreName, M_GET_SLICE, M_ENTRIES_HISTO).update(row.size());
}
示例4: open
@Override
public void open(WriteConfiguration config) {
metric = MetricManager.INSTANCE;
super.open(config);
}