当前位置: 首页>>代码示例>>Java>>正文


Java Metrics.newMeter方法代码示例

本文整理汇总了Java中com.yammer.metrics.Metrics.newMeter方法的典型用法代码示例。如果您正苦于以下问题:Java Metrics.newMeter方法的具体用法?Java Metrics.newMeter怎么用?Java Metrics.newMeter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.yammer.metrics.Metrics的用法示例。


在下文中一共展示了Metrics.newMeter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FileCacheMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
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();
        }
    });
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:FileCacheMetrics.java

示例2: FileCacheMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public FileCacheMetrics()
{
    hits = Metrics.newMeter(new MetricName(FileCacheService.class, "Hits"), "hits", TimeUnit.SECONDS);
    requests = Metrics.newMeter(new MetricName(FileCacheService.class, "Requests"), "requests", TimeUnit.SECONDS);
    hitRate = Metrics.newGauge(new MetricName(FileCacheService.class, "HitRate"), new RatioGauge()
    {
        protected double getNumerator()
        {
            return hits.count();
        }

        protected double getDenominator()
        {
            return requests.count();
        }
    });
    size = Metrics.newGauge(new MetricName(FileCacheService.class, "Size"), new Gauge<Long>()
    {
        public Long value()
        {
            return FileCacheService.instance.sizeInBytes();
        }
    });
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:25,代码来源:FileCacheMetrics.java

示例3: register

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
@PostConstruct
public void register() {
    mailTransactions =
            Metrics.newMeter(metricName("mailTransactions"),
                    "transactions", TimeUnit.MINUTES);
    rcptCommands =
            Metrics.newMeter(metricName("rcptCommands"), "commands",
                    TimeUnit.MINUTES);
    dataCommands =
            Metrics.newMeter(metricName("dataCommands"), "commands",
                    TimeUnit.MINUTES);
    acceptedMessages =
            Metrics.newMeter(metricName("acceptedMessages"), "messages",
                    TimeUnit.MINUTES);
    messageRecipients =
            Metrics.newMeter(metricName("messageRecipients"), "recipients",
                    TimeUnit.MINUTES);
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:19,代码来源:IncomingSmtpSummary.java

示例4: ClientRequestMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
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);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ClientRequestMetrics.java

示例5: IndexMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public IndexMetrics(ColumnFamilyStore cfs)
{
    IndexNameFactory nameFactory = new IndexNameFactory(cfs);

    timeouts = Metrics.newMeter(nameFactory.createMetricName("Timeouts"), "search timeouts", TimeUnit.SECONDS);
    failedRequests = Metrics.newMeter(nameFactory.createMetricName("FailedRequests"), "search failed requests", TimeUnit.SECONDS);
    requests = Metrics.newMeter(nameFactory.createMetricName("TotalRequests"), "search total requests", TimeUnit.SECONDS);
    latency = new LatencyMetrics(nameFactory, "Search");
}
 
开发者ID:xedin,项目名称:sasi,代码行数:10,代码来源:IndexMetrics.java

示例6: ControllerServerEventHandler

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public ControllerServerEventHandler() {
  Metrics.newGauge(new MetricName(ORG_APACHE_BLUR, BLUR, "Connections"), new Gauge<Long>() {
    @Override
    public Long value() {
      return null;
    }
  });
  _connectionMeter = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, BLUR, "Connections/s"), "Connections/s",
      TimeUnit.SECONDS);
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:11,代码来源:ControllerServerEventHandler.java

示例7: 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");

}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:41,代码来源:IndexManager.java

示例8: DroppedMessageMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public DroppedMessageMetrics(MessagingService.Verb verb)
{
    MetricNameFactory factory = new DefaultNameFactory("DroppedMessage", verb.toString());
    dropped = Metrics.newMeter(factory.createMetricName("Dropped"), "dropped", TimeUnit.SECONDS);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:6,代码来源:DroppedMessageMetrics.java

示例9: ConnectionMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
 * Create metrics for given connection pool.
 *
 * @param ip IP address to use for metrics label
 * @param connectionPool Connection pool
 */
public ConnectionMetrics(InetAddress ip, final OutboundTcpConnectionPool connectionPool)
{
    // ipv6 addresses will contain colons, which are invalid in a JMX ObjectName
    address = ip.getHostAddress().replace(':', '.');

    factory = new DefaultNameFactory("Connection", address);

    commandPendingTasks = Metrics.newGauge(factory.createMetricName("CommandPendingTasks"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return connectionPool.cmdCon.getPendingMessages();
        }
    });
    commandCompletedTasks = Metrics.newGauge(factory.createMetricName("CommandCompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return connectionPool.cmdCon.getCompletedMesssages();
        }
    });
    commandDroppedTasks = Metrics.newGauge(factory.createMetricName("CommandDroppedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return connectionPool.cmdCon.getDroppedMessages();
        }
    });
    responsePendingTasks = Metrics.newGauge(factory.createMetricName("ResponsePendingTasks"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return connectionPool.ackCon.getPendingMessages();
        }
    });
    responseCompletedTasks = Metrics.newGauge(factory.createMetricName("ResponseCompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return connectionPool.ackCon.getCompletedMesssages();
        }
    });
    timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:51,代码来源:ConnectionMetrics.java

示例10: CacheMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
 * Create metrics for given cache.
 *
 * @param type Type of Cache to identify metrics.
 * @param cache Cache to measure metrics
 */
public CacheMetrics(String type, final ICache cache)
{
    MetricNameFactory factory = new DefaultNameFactory("Cache", type);

    capacity = Metrics.newGauge(factory.createMetricName("Capacity"), new Gauge<Long>()
    {
        public Long value()
        {
            return cache.capacity();
        }
    });
    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 cache.weightedSize();
        }
    });
    entries = Metrics.newGauge(factory.createMetricName("Entries"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return cache.size();
        }
    });
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:47,代码来源:CacheMetrics.java

示例11: basicEcho

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
 * verify basic echo message rendezvous
 *
 * FIXME: Re-enable after making it pass on Windows without unncessary tight loop.
 *        https://github.com/netty/netty/issues/2853
 */
@Test(timeout = 10 * 1000)
@Ignore
public void basicEcho() throws Exception {

    final int messageSize = 64 * 1024;
    final int transferLimit = messageSize * 16;

    final Meter rate1 = Metrics.newMeter(
            NioUdtMessageRendezvousChannelTest.class, "send rate", "bytes", TimeUnit.SECONDS);

    final Meter rate2 = Metrics.newMeter(
            NioUdtMessageRendezvousChannelTest.class, "send rate", "bytes", TimeUnit.SECONDS);

    final InetSocketAddress addr1 = UnitHelp.localSocketAddress();
    final InetSocketAddress addr2 = UnitHelp.localSocketAddress();

    final EchoMessageHandler handler1 = new EchoMessageHandler(rate1, messageSize);
    final EchoMessageHandler handler2 = new EchoMessageHandler(rate2, messageSize);

    final NioEventLoopGroup group1 = new NioEventLoopGroup(
            1, Executors.defaultThreadFactory(), NioUdtProvider.MESSAGE_PROVIDER);
    final NioEventLoopGroup group2 = new NioEventLoopGroup(
            1, Executors.defaultThreadFactory(), NioUdtProvider.MESSAGE_PROVIDER);

    final Bootstrap boot1 = new Bootstrap();
    boot1.group(group1)
         .channelFactory(NioUdtProvider.MESSAGE_RENDEZVOUS)
         .localAddress(addr1).remoteAddress(addr2).handler(handler1);

    final Bootstrap boot2 = new Bootstrap();
    boot2.group(group2)
         .channelFactory(NioUdtProvider.MESSAGE_RENDEZVOUS)
         .localAddress(addr2).remoteAddress(addr1).handler(handler2);

    final ChannelFuture connectFuture1 = boot1.connect();
    final ChannelFuture connectFuture2 = boot2.connect();

    while (handler1.meter().count() < transferLimit
            && handler2.meter().count() < transferLimit) {

        log.info("progress : {} {}", handler1.meter().count(), handler2
                .meter().count());

        Thread.sleep(1000);
    }

    connectFuture1.channel().close().sync();
    connectFuture2.channel().close().sync();

    log.info("handler1 : {}", handler1.meter().count());
    log.info("handler2 : {}", handler2.meter().count());

    assertTrue(handler1.meter().count() >= transferLimit);
    assertTrue(handler2.meter().count() >= transferLimit);

    assertEquals(handler1.meter().count(), handler2.meter().count());

    group1.shutdownGracefully();
    group2.shutdownGracefully();

    group1.terminationFuture().sync();
    group2.terminationFuture().sync();
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:70,代码来源:NioUdtMessageRendezvousChannelTest.java

示例12: basicEcho

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
 * verify basic echo byte rendezvous
 */
@Test(timeout = 10 * 1000)
public void basicEcho() throws Exception {

    final int messageSize = 64 * 1024;
    final int transferLimit = messageSize * 16;

    final Meter rate1 = Metrics.newMeter(
            NioUdtMessageRendezvousChannelTest.class, "send rate", "bytes",
            TimeUnit.SECONDS);

    final Meter rate2 = Metrics.newMeter(
            NioUdtMessageRendezvousChannelTest.class, "send rate", "bytes",
            TimeUnit.SECONDS);

    final InetSocketAddress addr1 = UnitHelp.localSocketAddress();
    final InetSocketAddress addr2 = UnitHelp.localSocketAddress();

    final EchoByteHandler handler1 = new EchoByteHandler(rate1, messageSize);
    final EchoByteHandler handler2 = new EchoByteHandler(rate2, messageSize);

    final NioEventLoopGroup group1 = new NioEventLoopGroup(
            1, Executors.defaultThreadFactory(), NioUdtProvider.BYTE_PROVIDER);
    final NioEventLoopGroup group2 = new NioEventLoopGroup(
            1, Executors.defaultThreadFactory(), NioUdtProvider.BYTE_PROVIDER);

    final Bootstrap boot1 = new Bootstrap();
    boot1.group(group1)
         .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
         .localAddress(addr1)
         .remoteAddress(addr2)
         .handler(handler1);

    final Bootstrap boot2 = new Bootstrap();
    boot2.group(group1)
         .channelFactory(NioUdtProvider.BYTE_RENDEZVOUS)
         .localAddress(addr2)
         .remoteAddress(addr1)
         .handler(handler2);

    final ChannelFuture connectFuture1 = boot1.connect();
    final ChannelFuture connectFuture2 = boot2.connect();

    while (handler1.meter().count() < transferLimit
            && handler2.meter().count() < transferLimit) {

        log.info("progress : {} {}", handler1.meter().count(), handler2
                .meter().count());

        Thread.sleep(1000);
    }

    connectFuture1.channel().close().sync();
    connectFuture2.channel().close().sync();

    log.info("handler1 : {}", handler1.meter().count());
    log.info("handler2 : {}", handler2.meter().count());

    assertTrue(handler1.meter().count() >= transferLimit);
    assertTrue(handler2.meter().count() >= transferLimit);

    assertEquals(handler1.meter().count(), handler2.meter().count());

    group1.shutdownGracefully();
    group2.shutdownGracefully();

    group1.terminationFuture().sync();
    group2.terminationFuture().sync();
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:72,代码来源:NioUdtByteRendezvousChannelTest.java

示例13: ConnectionMetrics

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
/**
 * Create metrics for given connection pool.
 *
 * @param ip IP address to use for metrics label
 * @param connectionPool Connection pool
 */
public ConnectionMetrics(InetAddress ip, final OutboundTcpConnectionPool connectionPool)
{
    // ipv6 addresses will contain colons, which are invalid in a JMX ObjectName
    address = ip.getHostAddress().replaceAll(":", ".");

    factory = new DefaultNameFactory("Connection", address);

    commandPendingTasks = Metrics.newGauge(factory.createMetricName("CommandPendingTasks"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return connectionPool.cmdCon.getPendingMessages();
        }
    });
    commandCompletedTasks = Metrics.newGauge(factory.createMetricName("CommandCompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return connectionPool.cmdCon.getCompletedMesssages();
        }
    });
    commandDroppedTasks = Metrics.newGauge(factory.createMetricName("CommandDroppedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return connectionPool.cmdCon.getDroppedMessages();
        }
    });
    responsePendingTasks = Metrics.newGauge(factory.createMetricName("ResponsePendingTasks"), new Gauge<Integer>()
    {
        public Integer value()
        {
            return connectionPool.ackCon.getPendingMessages();
        }
    });
    responseCompletedTasks = Metrics.newGauge(factory.createMetricName("ResponseCompletedTasks"), new Gauge<Long>()
    {
        public Long value()
        {
            return connectionPool.ackCon.getCompletedMesssages();
        }
    });
    timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:51,代码来源:ConnectionMetrics.java

示例14: BaseCacheValueBufferPool

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public BaseCacheValueBufferPool(STORE store) {
  _store = store;
  _created = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, CACHE_POOL, CREATED), CREATED, TimeUnit.SECONDS);
  _reused = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, CACHE_POOL, REUSED), REUSED, TimeUnit.SECONDS);
  _detroyed = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, CACHE_POOL, DESTROYED), DESTROYED, TimeUnit.SECONDS);
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:7,代码来源:BaseCacheValueBufferPool.java

示例15: BlockDirectoryCache

import com.yammer.metrics.Metrics; //导入方法依赖的package包/类
public BlockDirectoryCache(BlockCache blockCache) {
  _blockCache = blockCache;
  hits = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, CACHE, HIT), HIT, TimeUnit.SECONDS);
  misses = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, CACHE, MISS), MISS, TimeUnit.SECONDS);
}
 
开发者ID:apache,项目名称:incubator-blur,代码行数:6,代码来源:BlockDirectoryCache.java


注:本文中的com.yammer.metrics.Metrics.newMeter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。