本文整理汇总了Java中com.yammer.metrics.Metrics.newTimer方法的典型用法代码示例。如果您正苦于以下问题:Java Metrics.newTimer方法的具体用法?Java Metrics.newTimer怎么用?Java Metrics.newTimer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.yammer.metrics.Metrics
的用法示例。
在下文中一共展示了Metrics.newTimer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CommitLogMetrics
import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public CommitLogMetrics(final AbstractCommitLogService service, final CommitLogSegmentManager allocator)
{
completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
{
public Long value()
{
return service.getCompletedTasks();
}
});
pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>()
{
public Long value()
{
return service.getPendingTasks();
}
});
totalCommitLogSize = Metrics.newGauge(factory.createMetricName("TotalCommitLogSize"), new Gauge<Long>()
{
public Long value()
{
return allocator.bytesUsed();
}
});
waitingOnSegmentAllocation = Metrics.newTimer(factory.createMetricName("WaitingOnSegmentAllocation"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
waitingOnCommit = Metrics.newTimer(factory.createMetricName("WaitingOnCommit"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
}
示例2: init
import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
@Override
public void init(Configuration queryExecutorConfig, DataManager dataManager, ServerMetrics serverMetrics)
throws ConfigurationException {
_serverMetrics = serverMetrics;
_queryExecutorConfig = new QueryExecutorConfig(queryExecutorConfig);
_instanceDataManager = (InstanceDataManager) dataManager;
if (_queryExecutorConfig.getTimeOut() > 0) {
_defaultTimeOutMs = _queryExecutorConfig.getTimeOut();
}
LOGGER.info("Default timeout for query executor : {}", _defaultTimeOutMs);
LOGGER.info("Trying to build SegmentPrunerService");
if (_segmentPrunerService == null) {
_segmentPrunerService = new SegmentPrunerServiceImpl(_queryExecutorConfig.getPrunerConfig());
}
LOGGER.info("Trying to build QueryPlanMaker");
_planMaker = new InstancePlanMakerImplV2();
LOGGER.info("Trying to build QueryExecutorTimer");
if (_queryExecutorTimer == null) {
_queryExecutorTimer =
Metrics.newTimer(new MetricName(Domain, "timer", "query-executor-time-"), TimeUnit.MILLISECONDS,
TimeUnit.SECONDS);
}
}
示例3: LatencyMetrics
import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
* Create LatencyMetrics with given group, type, prefix to append to each metric name, and scope.
*
* @param factory MetricName factory to use
* @param namePrefix Prefix to append to each metric name
*/
public LatencyMetrics(MetricNameFactory factory, String namePrefix)
{
this.factory = factory;
this.namePrefix = namePrefix;
latency = Metrics.newTimer(factory.createMetricName(namePrefix + "Latency"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
totalLatency = Metrics.newCounter(factory.createMetricName(namePrefix + "TotalLatency"));
}
示例4: IndexManager
import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public IndexManager(IndexServer indexServer, ClusterStatus clusterStatus, BlurFilterCache filterCache,
int maxHeapPerRowFetch, int fetchCount, int threadCount, int mutateThreadCount, int facetThreadCount,
DeepPagingCache deepPagingCache, MemoryAllocationWatcher memoryAllocationWatcher, QueryStatusManager statusManager) {
_statusManager = statusManager;
_memoryAllocationWatcher = memoryAllocationWatcher;
_deepPagingCache = deepPagingCache;
_indexServer = indexServer;
_clusterStatus = clusterStatus;
_filterCache = filterCache;
MetricName metricName1 = new MetricName(ORG_APACHE_BLUR, BLUR, "External Queries/s");
MetricName metricName2 = new MetricName(ORG_APACHE_BLUR, BLUR, "Internal Queries/s");
MetricName metricName3 = new MetricName(ORG_APACHE_BLUR, BLUR, "Fetch Timer");
_queriesExternalMeter = Metrics.newMeter(metricName1, "External Queries/s", TimeUnit.SECONDS);
_queriesInternalMeter = Metrics.newMeter(metricName2, "Internal Queries/s", TimeUnit.SECONDS);
_fetchTimer = Metrics.newTimer(metricName3, TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
if (threadCount == 0) {
throw new RuntimeException("Thread Count cannot be 0.");
}
_threadCount = threadCount;
if (mutateThreadCount == 0) {
throw new RuntimeException("Mutate Thread Count cannot be 0.");
}
_mutateThreadCount = mutateThreadCount;
_fetchCount = fetchCount;
_maxHeapPerRowFetch = maxHeapPerRowFetch;
_executor = Executors.newThreadPool("index-manager", _threadCount);
_mutateExecutor = Executors.newThreadPool("index-manager-mutate", _mutateThreadCount);
if (facetThreadCount < 1) {
_facetExecutor = null;
} else {
_facetExecutor = Executors.newThreadPool(new SynchronousQueue<Runnable>(), "facet-execution", facetThreadCount);
}
LOG.info("Init Complete");
}
示例5: newTimer
import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
*
* Return an existing timer if
* (a) A timer already exist with the same metric name.
* Otherwise, creates a new timer and registers
*
* @param registry MetricsRegistry
* @param name metric name
* @param durationUnit TimeUnit for duration
* @param rateUnit TimeUnit for rate determination
* @return Timer
*/
public static Timer newTimer(MetricsRegistry registry, MetricName name, TimeUnit durationUnit, TimeUnit rateUnit) {
if (registry != null) {
return registry.newTimer(name, durationUnit, rateUnit);
} else {
return Metrics.newTimer(name, durationUnit, rateUnit);
}
}