本文整理了Java中com.yammer.metrics.Metrics.newMeter()
方法的一些代码示例,展示了Metrics.newMeter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metrics.newMeter()
方法的具体详情如下:
包路径:com.yammer.metrics.Metrics
类名称:Metrics
方法名:newMeter
[英]Creates a new com.yammer.metrics.core.Meter and registers it under the given metric name.
[中]创建一个新的com。亚默。韵律学。果心并在给定的度量名称下注册。
代码示例来源:origin: apache/incubator-pinot
/**
*
* Return an existing meter if
* (a) A meter already exist with the same metric name.
* Otherwise, creates a new meter and registers
*
* @param registry MetricsRegistry
* @param name metric name
* @param eventType Event Type
* @param unit TimeUnit for rate determination
* @return Meter
*/
public static Meter newMeter(MetricsRegistry registry, MetricName name, String eventType, TimeUnit unit) {
if (registry != null) {
return registry.newMeter(name, eventType, unit);
} else {
return Metrics.newMeter(name, eventType, unit);
}
}
代码示例来源:origin: lealone/Lealone
/**
* Create metrics for given connection pool.
*
* @param ip IP address to use for metrics label
*/
public ConnectionMetrics(NetEndpoint ip) {
// ipv6 addresses will contain colons, which are invalid in a JMX ObjectName
String address = ip.getHostAddress().replaceAll(":", ".");
factory = new DefaultNameFactory("Connection", address);
timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
}
代码示例来源:origin: lealone/Lealone
public DroppedMessageMetrics(Verb verb) {
MetricNameFactory factory = new DefaultNameFactory("DroppedMessage", verb.toString());
dropped = Metrics.newMeter(factory.createMetricName("Dropped"), "dropped", TimeUnit.SECONDS);
}
}
代码示例来源:origin: addthis/hydra
public MeteredHealthCheck(int maxFailures, String meterName, TimeUnit meterInterval) {
super(maxFailures);
this.failedCheckMeter = Metrics.newMeter(MeteredHealthCheck.class, meterName, meterName, meterInterval);
}
代码示例来源:origin: facebookarchive/hive-io-experimental
/**
* Constructor
*
* @param hiveStats hive stats
*/
private Stats(HiveStats hiveStats) {
this.hiveStats = hiveStats;
rowMeter = Metrics.newMeter(Stats.class, "rows", "rows", SECONDS);
rawMBMeter = Metrics.newMeter(Stats.class, "megabytes (estimated)", "MBs", 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: com.facebook.presto.cassandra/cassandra-server
public ClientRequestMetrics(String scope)
{
super("ClientRequest", scope);
timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
unavailables = Metrics.newMeter(factory.createMetricName("Unavailables"), "unavailables", TimeUnit.SECONDS);
}
代码示例来源:origin: NGDATA/hbase-indexer
public DirectSolrInputDocumentWriter(String indexName, SolrClient solrServer) {
this.solrServer = solrServer;
indexAddMeter = Metrics.newMeter(metricName(getClass(), "Index adds", indexName), "Documents added to Solr index",
TimeUnit.SECONDS);
indexDeleteMeter = Metrics.newMeter(metricName(getClass(), "Index deletes", indexName),
"Documents deleted from Solr index", TimeUnit.SECONDS);
solrAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr add errors", indexName),
"Documents not added to Solr due to Solr errors", TimeUnit.SECONDS);
solrDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr delete errors", indexName),
"Documents not deleted from Solr due to Solr errors", TimeUnit.SECONDS);
documentAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Document add errors", indexName),
"Documents not added to Solr due to document errors", TimeUnit.SECONDS);
documentDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Document delete errors", indexName),
"Documents not deleted from Solr due to document errors", TimeUnit.SECONDS);
}
代码示例来源:origin: com.cerner.common.kafka/common-kafka
/**
* Returns the meter corresponding to the given scope.
*
* @param scope The scope of the meter to return.
*
* @return a {@link Meter} with the given scope.
*
* @throws IllegalArgumentException
* if {@code scope} is {@code null}.
*/
public Meter getMeter(String scope) {
if (scope == null) {
throw new IllegalArgumentException("scope cannot be null");
}
Meter meter = meters.get(scope);
if (meter == null) {
meter = Metrics.newMeter(clazz, name, scope, name, TimeUnit.SECONDS);
Meter existing = meters.putIfAbsent(scope, meter);
if (existing != null) {
meter = existing;
}
}
return meter;
}
}
代码示例来源:origin: NGDATA/hbase-indexer
public DirectSolrClassicInputDocumentWriter(String indexName, List<SolrClient> solrServers) {
this.solrServers = solrServers;
indexAddMeter = Metrics.newMeter(metricName(getClass(), "Index adds", indexName), "Documents added to Solr index",
TimeUnit.SECONDS);
indexDeleteMeter = Metrics.newMeter(metricName(getClass(), "Index deletes", indexName),
"Documents deleted from Solr index", TimeUnit.SECONDS);
solrAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr add errors", indexName),
"Documents not added to Solr due to Solr errors", TimeUnit.SECONDS);
solrDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr delete errors", indexName),
"Documents not deleted from Solr due to Solr errors", TimeUnit.SECONDS);
documentAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Document add errors", indexName),
"Documents not added to Solr due to document errors", TimeUnit.SECONDS);
documentDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Document delete errors", indexName),
"Documents not deleted from Solr due to document errors", TimeUnit.SECONDS);
}
代码示例来源:origin: com.ngdata/hbase-indexer-engine
public DirectSolrInputDocumentWriter(String indexName, SolrClient solrServer) {
this.solrServer = solrServer;
indexAddMeter = Metrics.newMeter(metricName(getClass(), "Index adds", indexName), "Documents added to Solr index",
TimeUnit.SECONDS);
indexDeleteMeter = Metrics.newMeter(metricName(getClass(), "Index deletes", indexName),
"Documents deleted from Solr index", TimeUnit.SECONDS);
solrAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr add errors", indexName),
"Documents not added to Solr due to Solr errors", TimeUnit.SECONDS);
solrDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr delete errors", indexName),
"Documents not deleted from Solr due to Solr errors", TimeUnit.SECONDS);
documentAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Document add errors", indexName),
"Documents not added to Solr due to document errors", TimeUnit.SECONDS);
documentDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Document delete errors", indexName),
"Documents not deleted from Solr due to document errors", TimeUnit.SECONDS);
}
代码示例来源:origin: com.ngdata/hbase-indexer-engine
public DirectSolrClassicInputDocumentWriter(String indexName, List<SolrClient> solrServers) {
this.solrServers = solrServers;
indexAddMeter = Metrics.newMeter(metricName(getClass(), "Index adds", indexName), "Documents added to Solr index",
TimeUnit.SECONDS);
indexDeleteMeter = Metrics.newMeter(metricName(getClass(), "Index deletes", indexName),
"Documents deleted from Solr index", TimeUnit.SECONDS);
solrAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr add errors", indexName),
"Documents not added to Solr due to Solr errors", TimeUnit.SECONDS);
solrDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Solr delete errors", indexName),
"Documents not deleted from Solr due to Solr errors", TimeUnit.SECONDS);
documentAddErrorMeter = Metrics.newMeter(metricName(getClass(), "Document add errors", indexName),
"Documents not added to Solr due to document errors", TimeUnit.SECONDS);
documentDeleteErrorMeter = Metrics.newMeter(metricName(getClass(), "Document delete errors", indexName),
"Documents not deleted from Solr due to document errors", TimeUnit.SECONDS);
}
代码示例来源:origin: addthis/hydra
public MapFeeder(StreamMapper task, TaskDataSource source, int feeders) {
if (shouldSteal) {
stealAttemptMeter = Metrics.newMeter(getClass(), "stealAttemptRate", "steals", TimeUnit.SECONDS);
stealSuccessMeter = Metrics.newMeter(getClass(), "stealSuccessRate", "steals", TimeUnit.SECONDS);
} else {
stealAttemptMeter = null;
stealSuccessMeter = null;
}
this.source = source;
this.task = task;
this.feeders = feeders;
shardField = source.getShardField();
threads = new Thread[feeders];
queues = new LinkedBlockingQueue[feeders];
for (int i = 0; i < threads.length; i++) {
queues[i] = new LinkedBlockingQueue<>(QUEUE_DEPTH);
threads[i] = new Thread(new MapperTask(this, i), "MapProcessor #" + i);
}
}
代码示例来源:origin: com.senseidb/sensei-core
IndexingMetrics(int partition) {
MetricName docsIndexedName = new MetricName(MetricsConstants.Domain, "meter", "docs-indexed",
"indexer");
docsIndexedMetric = Metrics.newMeter(docsIndexedName, "indexing", TimeUnit.SECONDS);
MetricName docsLeftoverName = new MetricName(MetricsConstants.Domain, "meter",
"docs-leftover", "indexer");
docsLeftoverMetric = Metrics.newMeter(docsLeftoverName, "indexing", TimeUnit.SECONDS);
MetricName flushTimeName = new MetricName(MetricsConstants.Domain, "histogram", "flush-time",
"indexer");
flushTimeHistogram = Metrics.newHistogram(flushTimeName, false);
}
}
代码示例来源: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: NGDATA/hbase-indexer
incomingEventsMeter = Metrics.newMeter(metricName(getClass(), "Incoming events", indexer.getName()),
"Rate of incoming SEP events", TimeUnit.SECONDS);
applicableEventsMeter = Metrics.newMeter(metricName(getClass(), "Applicable events", indexer.getName()),
"Rate of incoming SEP events that are considered applicable", TimeUnit.SECONDS);
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
public DroppedMessageMetrics(MessagingService.Verb verb)
{
MetricNameFactory factory = new DefaultNameFactory("DroppedMessage", verb.toString());
dropped = Metrics.newMeter(factory.createMetricName("Dropped"), "dropped", TimeUnit.SECONDS);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
public FileCacheMetrics()
{
hits = Metrics.newMeter(factory.createMetricName("Hits"), "hits", TimeUnit.SECONDS);
requests = Metrics.newMeter(factory.createMetricName("Requests"), "requests", TimeUnit.SECONDS);
hitRate = Metrics.newGauge(factory.createMetricName("HitRate"), new RatioGauge()
{
protected double getNumerator()
{
return hits.count();
}
protected double getDenominator()
{
return requests.count();
}
});
size = Metrics.newGauge(factory.createMetricName("Size"), new Gauge<Long>()
{
public Long value()
{
return FileCacheService.instance.sizeInBytes();
}
});
}
}
代码示例来源:origin: addthis/metrics-reporter-config
private void runLoop(ReporterConfig config) throws Exception
{
Counter counter = Metrics.newCounter(getClass(), "counter");
Meter meter = Metrics.newMeter(getClass(), "meter", "foo", TimeUnit.SECONDS);
config.enableConsole();
for (int i=0; i< loops; i++)
{
counter.inc();
meter.mark();
Thread.sleep(1000);
log.debug("runLoop tick");
}
log.info("Done with sample data loop");
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server
public CompactionMetrics(final ThreadPoolExecutor... collectors)
{
pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Integer>()
{
public Integer value()
{
int n = 0;
// add estimate number of compactions need to be done
for (String keyspaceName : Schema.instance.getKeyspaces())
{
for (ColumnFamilyStore cfs : Keyspace.open(keyspaceName).getColumnFamilyStores())
n += cfs.getCompactionStrategy().getEstimatedRemainingTasks();
}
// add number of currently running compactions
return n + compactions.size();
}
});
completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
{
public Long value()
{
long completedTasks = 0;
for (ThreadPoolExecutor collector : collectors)
completedTasks += collector.getCompletedTaskCount();
return completedTasks;
}
});
totalCompactionsCompleted = Metrics.newMeter(factory.createMetricName("TotalCompactionsCompleted"), "compaction completed", TimeUnit.SECONDS);
bytesCompacted = Metrics.newCounter(factory.createMetricName("BytesCompacted"));
}
内容来源于网络,如有侵权,请联系作者删除!