本文整理了Java中com.yammer.metrics.Metrics.newTimer()
方法的一些代码示例,展示了Metrics.newTimer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metrics.newTimer()
方法的具体详情如下:
包路径:com.yammer.metrics.Metrics
类名称:Metrics
方法名:newTimer
[英]Creates a new com.yammer.metrics.core.Timer and registers it under the given metric name.
[中]创建一个新的com。亚默。韵律学。果心计时器,并在给定的度量名称下注册它。
代码示例来源:origin: apache/incubator-pinot
/**
*
* 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);
}
}
代码示例来源:origin: apache/usergrid
Timer timer = Metrics.newTimer( BcryptCommandTest.class, "hashtimer" );
代码示例来源:origin: urbanairship/statshtable
SHTimerMetric(TimeUnit durationUnit, TimeUnit rateUnit) {
t = Metrics.newTimer(this.getClass(),"Timer",durationUnit, rateUnit);
}
代码示例来源:origin: sematext/ActionGenerator
/**
* Constructor.
*
* @param clazz
* class for calculating metrics
*/
public BasicMetrics(Class<?> clazz) {
sinkRequests = Metrics.newMeter(clazz, "sinkRequests", "sinkRequests", TimeUnit.SECONDS);
sinkTimer = Metrics.newTimer(clazz, "responses", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
requestsTimer = Metrics.newTimer(clazz, "requests", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
代码示例来源:origin: com.ning/metrics.eventtracker-http
public HttpSender(final String collectorHost, final int collectorPort, final EventType eventType,
final long httpMaxWaitTimeInMillis, final long httpMaxKeepAliveInMillis, final int httpWorkersPoolSize)
{
this(new ThreadSafeAsyncHttpClient(collectorHost, collectorPort, eventType, httpMaxKeepAliveInMillis),
httpMaxWaitTimeInMillis,
Metrics.newTimer(HttpSender.class, collectorHost.replace(":", "_"), TimeUnit.MILLISECONDS, TimeUnit.SECONDS),
httpWorkersPoolSize);
}
代码示例来源:origin: pierre/meteo
public AMQSession(final AMQPublisherConfig config, final AMQConnection connection, final String topic,
final AtomicBoolean useBytesMessage)
{
this.config = config;
this.connection = connection;
this.topic = topic;
this.useBytesMessage = useBytesMessage;
timer = Metrics.newTimer(AMQSession.class, topic, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
reinit();
}
代码示例来源:origin: NGDATA/hbase-indexer
public RowBasedIndexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper,
Connection tablePool,
Sharder sharder, SolrInputDocumentWriter solrWriter) {
super(indexerName, conf, tableName, mapper, sharder, solrWriter);
this.tablePool = tablePool;
rowReadTimer = Metrics.newTimer(metricName(getClass(), "Row read timer", indexerName), TimeUnit.MILLISECONDS,
TimeUnit.SECONDS);
}
代码示例来源:origin: com.senseidb/sensei-core
public ActivityPrimitivesStorage(String fieldName, String indexDir) {
this.fieldName = fieldName;
this.indexDir = indexDir;
timer = Metrics.newTimer(new MetricName(MetricsConstants.Domain, "timer",
"initIntActivities-time-" + fieldName.replaceAll(":", "-"), "initIntActivities"),
TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
代码示例来源:origin: com.senseidb/sensei-core
public CompositeActivityStorage(String indexDir) {
this.indexDir = indexDir;
timer = Metrics.newTimer(new MetricName(MetricsConstants.Domain, "timer",
"initCompositeActivities-time", "CompositeActivityStorage"), TimeUnit.MILLISECONDS,
TimeUnit.SECONDS);
}
代码示例来源:origin: com.sematext.ag/ag-player
/**
* Constructor.
*
* @param clazz
* class for calculating metrics
*/
public BasicMetrics(Class<?> clazz) {
requests = Metrics.newMeter(clazz, "requests", "requests", TimeUnit.SECONDS);
timer = Metrics.newTimer(clazz, "responses", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
代码示例来源:origin: rackerlabs/atom-hopper
private TimerContext startTimer(String name) {
if (enableTimers) {
final com.yammer.metrics.core.Timer timer = Metrics.newTimer(getClass(), name, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
TimerContext context = timer.time();
return context;
} else {
return null;
}
}
代码示例来源:origin: com.ngdata/hbase-indexer-engine
public RowBasedIndexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper,
Connection tablePool,
Sharder sharder, SolrInputDocumentWriter solrWriter) {
super(indexerName, conf, tableName, mapper, sharder, solrWriter);
this.tablePool = tablePool;
rowReadTimer = Metrics.newTimer(metricName(getClass(), "Row read timer", indexerName), TimeUnit.MILLISECONDS,
TimeUnit.SECONDS);
}
代码示例来源:origin: com.senseidb/sensei-core
private Timer buildTimer(int partition) {
MetricName partitionSearchMetricName = new MetricName(MetricsConstants.Domain, "timer",
"partition-time-" + partition, "partition");
return Metrics.newTimer(partitionSearchMetricName, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
代码示例来源:origin: rackerlabs/atom-hopper
private TimerContext startTimer(String name) {
if (enableTimers) {
final com.yammer.metrics.core.Timer timer = Metrics.newTimer( getClass(), name, TimeUnit.MILLISECONDS,
TimeUnit.SECONDS );
TimerContext context = timer.time();
return context;
} else {
return null;
}
}
代码示例来源:origin: NGDATA/hbase-indexer
Indexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper, Sharder sharder,
SolrInputDocumentWriter solrWriter) {
this.indexerName = indexerName;
this.conf = conf;
this.tableName = tableName;
this.mapper = mapper;
try {
this.uniqueKeyFormatter = conf.getUniqueKeyFormatterClass().newInstance();
} catch (Exception e) {
throw new RuntimeException("Problem instantiating the UniqueKeyFormatter.", e);
}
ConfigureUtil.configure(uniqueKeyFormatter, conf.getGlobalParams());
this.sharder = sharder;
this.solrWriter = solrWriter;
this.indexingTimer = Metrics.newTimer(metricName(getClass(),
"Index update calculation timer", indexerName),
TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
代码示例来源:origin: com.ngdata/hbase-indexer-engine
Indexer(String indexerName, IndexerConf conf, String tableName, ResultToSolrMapper mapper, Sharder sharder,
SolrInputDocumentWriter solrWriter) {
this.indexerName = indexerName;
this.conf = conf;
this.tableName = tableName;
this.mapper = mapper;
try {
this.uniqueKeyFormatter = conf.getUniqueKeyFormatterClass().newInstance();
} catch (Exception e) {
throw new RuntimeException("Problem instantiating the UniqueKeyFormatter.", e);
}
ConfigureUtil.configure(uniqueKeyFormatter, conf.getGlobalParams());
this.sharder = sharder;
this.solrWriter = solrWriter;
this.indexingTimer = Metrics.newTimer(metricName(getClass(),
"Index update calculation timer", indexerName),
TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
/**
* 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"));
}
代码示例来源:origin: wavefrontHQ/java
/**
* Create new instance
*
* @param proxyAPI handles interaction with Wavefront servers as well as queueing.
* @param handle handle (usually port number), that serves as an identifier for the metrics pipeline.
* @param threadId thread number.
* @param rateLimiter rate limiter to control outbound point rate.
* @param pushFlushInterval interval between flushes.
* @param itemsPerBatch max points per flush.
* @param memoryBufferLimit max points in task's memory buffer before queueing.
*
*/
ReportSourceTagSenderTask(ForceQueueEnabledAgentAPI proxyAPI, String handle, int threadId,
AtomicInteger pushFlushInterval,
@Nullable RecyclableRateLimiter rateLimiter,
@Nullable AtomicInteger itemsPerBatch,
@Nullable AtomicInteger memoryBufferLimit) {
super("sourceTags", handle, threadId, itemsPerBatch, memoryBufferLimit);
this.proxyAPI = proxyAPI;
this.batchSendTime = Metrics.newTimer(new MetricName("api.sourceTags." + handle, "", "duration"),
TimeUnit.MILLISECONDS, TimeUnit.MINUTES);
this.pushFlushInterval = pushFlushInterval;
this.rateLimiter = rateLimiter;
this.permitsGranted = Metrics.newCounter(new MetricName("limiter", "", "permits-granted"));
this.permitsDenied = Metrics.newCounter(new MetricName("limiter", "", "permits-denied"));
this.permitsRetried = Metrics.newCounter(new MetricName("limiter", "", "permits-retried"));
this.scheduler.schedule(this, this.pushFlushInterval.get(), TimeUnit.MILLISECONDS);
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Constructor
*
* @param name String name
* @param printPeriod how often to print
*/
public MetricsObserver(String name, int printPeriod) {
TimeUnit durationUnit = TimeUnit.MICROSECONDS;
TimeUnit rateUnit = TimeUnit.MILLISECONDS;
this.printPeriod = printPeriod;
readTimer = Metrics.newTimer(new MetricName(name, "", "reads"),
durationUnit, rateUnit);
readSuccessRatio =
new CounterRatioGauge(Metrics.newCounter(new MetricName(name, "", "successes")),
Metrics.newCounter(new MetricName(name, "", "-reads")));
parseTimer = Metrics.newTimer(new MetricName(name, "", "parses"),
durationUnit, rateUnit);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
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);
}
}
内容来源于网络,如有侵权,请联系作者删除!