当前位置: 首页>>代码示例>>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;未经允许,请勿转载。