當前位置: 首頁>>代碼示例>>Java>>正文


Java Metrics.newCounter方法代碼示例

本文整理匯總了Java中com.yammer.metrics.Metrics.newCounter方法的典型用法代碼示例。如果您正苦於以下問題:Java Metrics.newCounter方法的具體用法?Java Metrics.newCounter怎麽用?Java Metrics.newCounter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.yammer.metrics.Metrics的用法示例。


在下文中一共展示了Metrics.newCounter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createColumnFamilyCounter

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
/**
 * Creates a counter that will also have a global counter thats the sum of all counters across 
 * different column families
 */
protected Counter createColumnFamilyCounter(final String name)
{
    Counter cfCounter = Metrics.newCounter(factory.createMetricName(name));
    if (register(name, cfCounter))
    {
        Metrics.newGauge(globalNameFactory.createMetricName(name), new Gauge<Long>()
        {
            public Long value()
            {
                long total = 0;
                for (Metric cfGauge : allColumnFamilyMetrics.get(name))
                {
                    total += ((Counter) cfGauge).count();
                }
                return total;
            }
        });
    }
    return cfCounter;
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:25,代碼來源:ColumnFamilyMetrics.java

示例2: CQLMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public CQLMetrics()
{
    regularStatementsExecuted = Metrics.newCounter(factory.createMetricName("RegularStatementsExecuted"));
    preparedStatementsExecuted = Metrics.newCounter(factory.createMetricName("PreparedStatementsExecuted"));
    preparedStatementsEvicted = Metrics.newCounter(factory.createMetricName("PreparedStatementsEvicted"));

    preparedStatementsCount = Metrics.newGauge(factory.createMetricName("PreparedStatementsCount"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return QueryProcessor.preparedStatementsCount();
        }
    });
    preparedStatementsRatio = Metrics.newGauge(factory.createMetricName("PreparedStatementsRatio"), new RatioGauge()
    {
        public double getNumerator()
        {
            return preparedStatementsExecuted.count();
        }

        public double getDenominator()
        {
            return regularStatementsExecuted.count() + preparedStatementsExecuted.count();
        }
    });
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:27,代碼來源:CQLMetrics.java

示例3: createNewMetricsGroup

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
protected MetricsGroup createNewMetricsGroup(String scope) {
  MetricName readRandomAccessName = new MetricName(ORG_APACHE_BLUR, HDFS, "Read Random Latency in \u00B5s", scope);
  MetricName readStreamAccessName = new MetricName(ORG_APACHE_BLUR, HDFS, "Read Stream Latency in \u00B5s", scope);
  MetricName writeAcccessName = new MetricName(ORG_APACHE_BLUR, HDFS, "Write Latency in \u00B5s", scope);
  MetricName readRandomThroughputName = new MetricName(ORG_APACHE_BLUR, HDFS, "Read Random Throughput", scope);
  MetricName readStreamThroughputName = new MetricName(ORG_APACHE_BLUR, HDFS, "Read Stream Throughput", scope);
  MetricName readSeekName = new MetricName(ORG_APACHE_BLUR, HDFS, "Read Stream Seeks", scope);
  MetricName writeThroughputName = new MetricName(ORG_APACHE_BLUR, HDFS, "Write Throughput", scope);
  MetricName totalHdfsBlocks = new MetricName(ORG_APACHE_BLUR, HDFS, "Hdfs Blocks Total", scope);
  MetricName localHdfsBlocks = new MetricName(ORG_APACHE_BLUR, HDFS, "Hdfs Blocks Local", scope);

  Histogram readRandomAccess = Metrics.newHistogram(readRandomAccessName);
  Histogram readStreamAccess = Metrics.newHistogram(readStreamAccessName);
  Histogram writeAccess = Metrics.newHistogram(writeAcccessName);
  Meter readRandomThroughput = Metrics.newMeter(readRandomThroughputName, "Read Random Bytes", TimeUnit.SECONDS);
  Meter readStreamThroughput = Metrics.newMeter(readStreamThroughputName, "Read Stream Bytes", TimeUnit.SECONDS);
  Meter readStreamSeek = Metrics.newMeter(readSeekName, "Read Stream Seeks", TimeUnit.SECONDS);
  Meter writeThroughput = Metrics.newMeter(writeThroughputName, "Write Bytes", TimeUnit.SECONDS);
  Counter totalHdfsBlock = Metrics.newCounter(totalHdfsBlocks);
  Counter localHdfsBlock = Metrics.newCounter(localHdfsBlocks);

  return new MetricsGroup(readRandomAccess, readStreamAccess, writeAccess, readRandomThroughput,
      readStreamThroughput, readStreamSeek, writeThroughput, totalHdfsBlock, localHdfsBlock);
}
 
開發者ID:apache,項目名稱:incubator-blur,代碼行數:25,代碼來源:HdfsDirectory.java

示例4: zeroesNotReportedByDefault

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
@Test
public void zeroesNotReportedByDefault() throws Exception {
    Metrics.newCounter(this.getClass(), "counter3333"); // create zero counter
    final AnodotReporterWrapper reporter = Anodot2ReporterBuilder.builderFor(conf).build(Metrics.defaultRegistry());
    runReportCycle(reporter);
    verify(exactly(0), postRequestedFor(urlEqualTo("/anodot?token=t")).withRequestBody(containing("counter3333")));
}
 
開發者ID:kenshoo,項目名稱:anodot-metrics-bridge,代碼行數:8,代碼來源:Anodot2ReporterBuilderTest.java

示例5: zeroFilterTurnedOffMeansNoFilters

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
@Test
public void zeroFilterTurnedOffMeansNoFilters() throws Exception {
    Metrics.newCounter(this.getClass(), "counter"); // create zero counter
    final AnodotReporterWrapper reporter = Anodot2ReporterBuilder.builderFor(conf).turnZeroFilterOff().build(Metrics.defaultRegistry());
    runReportCycle(reporter);
    verify(postRequestedFor(urlEqualTo("/anodot?token=t")));
}
 
開發者ID:kenshoo,項目名稱:anodot-metrics-bridge,代碼行數:8,代碼來源:Anodot2ReporterBuilderTest.java

示例6: 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"));
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:15,代碼來源:LatencyMetrics.java

示例7: ThreadPoolMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
/**
 * Create metrics for given ThreadPoolExecutor.
 *
 * @param executor Thread pool
 * @param path Type of thread pool
 * @param poolName Name of thread pool to identify metrics
 */
public ThreadPoolMetrics(final ThreadPoolExecutor executor, String path, String poolName)
{
    this.factory = new ThreadPoolMetricNameFactory("ThreadPools", path, poolName);

    activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return executor.getActiveCount();
        }
    });
    totalBlocked = Metrics.newCounter(factory.createMetricName("TotalBlockedTasks"));
    currentBlocked = Metrics.newCounter(factory.createMetricName("CurrentlyBlockedTasks"));
    completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return executor.getCompletedTaskCount();
        }
    });
    pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return executor.getTaskCount() - executor.getCompletedTaskCount();
        }
    });
    maxPoolSize =  Metrics.newGauge(factory.createMetricName("MaxPoolSize"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return executor.getMaximumPoolSize();
        }
    });
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:43,代碼來源:ThreadPoolMetrics.java

示例8: ThreadPoolMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
/**
 * Create metrics for given ThreadPoolExecutor.
 *
 * @param executor Thread pool
 * @param path Type of thread pool
 * @param poolName Name of thread pool to identify metrics
 */
public ThreadPoolMetrics(final ThreadPoolExecutor executor, String path, String poolName)
{
    this.factory = new ThreadPoolMetricNameFactory(path, poolName);

    activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return executor.getActiveCount();
        }
    });
    totalBlocked = Metrics.newCounter(factory.createMetricName("TotalBlockedTasks"));
    currentBlocked = Metrics.newCounter(factory.createMetricName("CurrentlyBlockedTasks"));
    completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return executor.getCompletedTaskCount();
        }
    });
    pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return executor.getTaskCount() - executor.getCompletedTaskCount();
        }
    });
}
 
開發者ID:pgaref,項目名稱:ACaZoo,代碼行數:36,代碼來源:ThreadPoolMetrics.java

示例9: init

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
@Override
public void init(TableDataManagerConfig tableDataManagerConfig) {
  _tableDataManagerConfig = tableDataManagerConfig;
  _tableName = _tableDataManagerConfig.getTableName();
  LOGGER = LoggerFactory.getLogger(_tableName + "-RealtimeTableDataManager");
  _currentNumberOfSegments =
      Metrics.newCounter(RealtimeTableDataManager.class, _tableName + "-"
          + CommonConstants.Metric.Server.CURRENT_NUMBER_OF_SEGMENTS);
  _currentNumberOfDocuments =
      Metrics.newCounter(RealtimeTableDataManager.class, _tableName + "-"
          + CommonConstants.Metric.Server.CURRENT_NUMBER_OF_DOCUMENTS);
  _numDeletedSegments =
      Metrics.newCounter(RealtimeTableDataManager.class, _tableName + "-"
          + CommonConstants.Metric.Server.NUMBER_OF_DELETED_SEGMENTS);

  _tableDataDir = _tableDataManagerConfig.getDataDir();
  if (!new File(_tableDataDir).exists()) {
    new File(_tableDataDir).mkdirs();
  }
  _numberOfTableQueryExecutorThreads = _tableDataManagerConfig.getNumberOfTableQueryExecutorThreads();
  if (_numberOfTableQueryExecutorThreads > 0) {
    _queryExecutorService =
        Executors.newFixedThreadPool(_numberOfTableQueryExecutorThreads, new NamedThreadFactory(
            "parallel-query-executor-" + _tableName));
  } else {
    _queryExecutorService =
        Executors.newCachedThreadPool(new NamedThreadFactory("parallel-query-executor-" + _tableName));
  }
  _readMode = ReadMode.valueOf(_tableDataManagerConfig.getReadMode());
  _indexLoadingConfigMetadata = _tableDataManagerConfig.getIndexLoadingConfigMetadata();
  LOGGER.info("Initialized RealtimeTableDataManager: table : " + _tableName + " with :\n\tData Directory: "
      + _tableDataDir + "\n\tRead Mode : " + _readMode + "\n\tQuery Exeutor with "
      + ((_numberOfTableQueryExecutorThreads > 0) ? _numberOfTableQueryExecutorThreads : "cached") + " threads");
}
 
開發者ID:Hanmourang,項目名稱:Pinot,代碼行數:35,代碼來源:RealtimeTableDataManager.java

示例10: init

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
@Override
public void init(TableDataManagerConfig tableDataManagerConfig) {
  _tableDataManagerConfig = tableDataManagerConfig;
  _tableName = _tableDataManagerConfig.getTableName();

  LOGGER = LoggerFactory.getLogger(_tableName + "-OfflineTableDataManager");
  _currentNumberOfSegments =
      Metrics.newCounter(OfflineTableDataManager.class, _tableName + "-"
          + CommonConstants.Metric.Server.CURRENT_NUMBER_OF_SEGMENTS);
  _currentNumberOfDocuments =
      Metrics.newCounter(OfflineTableDataManager.class, _tableName + "-"
          + CommonConstants.Metric.Server.CURRENT_NUMBER_OF_DOCUMENTS);
  _numDeletedSegments =
      Metrics.newCounter(OfflineTableDataManager.class, _tableName + "-"
          + CommonConstants.Metric.Server.NUMBER_OF_DELETED_SEGMENTS);

  _tableDataDir = _tableDataManagerConfig.getDataDir();
  if (!new File(_tableDataDir).exists()) {
    new File(_tableDataDir).mkdirs();
  }
  _numberOfTableQueryExecutorThreads = _tableDataManagerConfig.getNumberOfTableQueryExecutorThreads();
  //_numberOfTableQueryExecutorThreads = 1;
  if (_numberOfTableQueryExecutorThreads > 0) {
    _queryExecutorService =
        Executors.newFixedThreadPool(_numberOfTableQueryExecutorThreads, new NamedThreadFactory(
            "parallel-query-executor-" + _tableName));
  } else {
    _queryExecutorService =
        Executors.newCachedThreadPool(new NamedThreadFactory("parallel-query-executor-" + _tableName));
  }
  _readMode = ReadMode.valueOf(_tableDataManagerConfig.getReadMode());
  _indexLoadingConfigMetadata = _tableDataManagerConfig.getIndexLoadingConfigMetadata();
  LOGGER
      .info("Initialized table : " + _tableName + " with :\n\tData Directory: " + _tableDataDir
          + "\n\tRead Mode : " + _readMode + "\n\tQuery Exeutor with "
          + ((_numberOfTableQueryExecutorThreads > 0) ? _numberOfTableQueryExecutorThreads : "cached")
          + " threads");
}
 
開發者ID:Hanmourang,項目名稱:Pinot,代碼行數:39,代碼來源:OfflineTableDataManager.java

示例11: nonZeroCounterNotFilteredOut

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
@Test
public void nonZeroCounterNotFilteredOut() throws Exception {
    final Counter counter = Metrics.newCounter(this.getClass(), "counter1");
    counter.inc();
    assertThat(filter.matches(METRIC_NAME, counter), is(true));
}
 
開發者ID:kenshoo,項目名稱:anodot-metrics-bridge,代碼行數:7,代碼來源:Anodot2NonZeroFilterTest.java

示例12: StreamingMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public StreamingMetrics(final InetAddress peer)
{
    MetricNameFactory factory = new DefaultNameFactory("Streaming", peer.getHostAddress().replace(':', '.'));
    incomingBytes = Metrics.newCounter(factory.createMetricName("IncomingBytes"));
    outgoingBytes= Metrics.newCounter(factory.createMetricName("OutgoingBytes"));
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:7,代碼來源:StreamingMetrics.java

示例13: load

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public Counter load(InetAddress address)
{
    return Metrics.newCounter(factory.createMetricName("Hints_created-" + address.getHostAddress().replace(':', '.')));
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:5,代碼來源:HintedHandoffMetrics.java

示例14: DifferencingCounter

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public DifferencingCounter(InetAddress address)
{
    this.meter = Metrics.newCounter(factory.createMetricName("Hints_not_stored-" + address.getHostAddress().replace(':', '.')));
}
 
開發者ID:vcostet,項目名稱:cassandra-kmean,代碼行數:5,代碼來源:HintedHandoffMetrics.java

示例15: StreamingMetrics

import com.yammer.metrics.Metrics; //導入方法依賴的package包/類
public StreamingMetrics(final InetAddress peer)
{
    MetricNameFactory factory = new DefaultNameFactory("Streaming", peer.getHostAddress().replaceAll(":", "."));
    incomingBytes = Metrics.newCounter(factory.createMetricName("IncomingBytes"));
    outgoingBytes= Metrics.newCounter(factory.createMetricName("OutgoingBytes"));
}
 
開發者ID:pgaref,項目名稱:ACaZoo,代碼行數:7,代碼來源:StreamingMetrics.java


注:本文中的com.yammer.metrics.Metrics.newCounter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。