當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。