本文整理汇总了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);
}