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


Java JmxReporter类代码示例

本文整理汇总了Java中com.yammer.metrics.reporting.JmxReporter的典型用法代码示例。如果您正苦于以下问题:Java JmxReporter类的具体用法?Java JmxReporter怎么用?Java JmxReporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: main

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    int port = 8080;
    String filtersPath = "/Users/nbeveridge/Development/git/zuul-netty/zuul-core/src/main/filters/pre";
    if (args.length >= 2) {
        port = Integer.parseInt(args[0]);
        filtersPath = args[1];
    }

    InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
    LOG.info("Starting server...");

    ZuulFiltersLoader changeNotifier = new ZuulFiltersLoader(
            Paths.get(filtersPath));
    ProxyServer proxyServer = new ProxyServer(port)
            .setFiltersChangeNotifier(changeNotifier);

    proxyServer.run().get();
    changeNotifier.reload();


    JmxReporter.startDefault(Metrics.defaultRegistry());

    //ConsoleReporter.enable(1, TimeUnit.SECONDS);
}
 
开发者ID:neilbeveridge,项目名称:zuul-netty,代码行数:25,代码来源:ProxyServer.java

示例2: MetricsConnection

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
public MetricsConnection(final ConnectionManager.HConnectionImplementation conn) {
  this.scope = conn.toString();
  this.registry = new MetricsRegistry();
  final ThreadPoolExecutor batchPool = (ThreadPoolExecutor) conn.getCurrentBatchPool();
  final ThreadPoolExecutor metaPool = (ThreadPoolExecutor) conn.getCurrentMetaLookupPool();

  this.registry.newGauge(this.getClass(), "executorPoolActiveThreads", scope,
      new RatioGauge() {
        @Override protected double getNumerator() {
          return batchPool.getActiveCount();
        }
        @Override protected double getDenominator() {
          return batchPool.getMaximumPoolSize();
        }
      });
  this.registry.newGauge(this.getClass(), "metaPoolActiveThreads", scope,
      new RatioGauge() {
        @Override protected double getNumerator() {
          return metaPool.getActiveCount();
        }
        @Override protected double getDenominator() {
          return metaPool.getMaximumPoolSize();
        }
      });
  this.metaCacheHits = registry.newCounter(this.getClass(), "metaCacheHits", scope);
  this.metaCacheMisses = registry.newCounter(this.getClass(), "metaCacheMisses", scope);
  this.getTracker = new CallTracker(this.registry, "Get", scope);
  this.scanTracker = new CallTracker(this.registry, "Scan", scope);
  this.appendTracker = new CallTracker(this.registry, "Mutate", "Append", scope);
  this.deleteTracker = new CallTracker(this.registry, "Mutate", "Delete", scope);
  this.incrementTracker = new CallTracker(this.registry, "Mutate", "Increment", scope);
  this.putTracker = new CallTracker(this.registry, "Mutate", "Put", scope);
  this.multiTracker = new CallTracker(this.registry, "Multi", scope);
  this.runnerStats = new RunnerStats(this.registry);

  this.reporter = new JmxReporter(this.registry);
  this.reporter.start();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:MetricsConnection.java

示例3: getCacheMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve cache metrics based on the cache type (KeyCache, RowCache, or CounterCache)
 * @param cacheType KeyCach, RowCache, or CounterCache
 * @param metricName Capacity, Entries, HitRate, Size, Requests or Hits.
 */
public Object getCacheMetric(String cacheType, String metricName)
{
    try
    {
        switch(metricName)
        {
            case "Capacity":
            case "Entries":
            case "HitRate":
            case "Size":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Cache,scope=" + cacheType + ",name=" + metricName),
                        JmxReporter.GaugeMBean.class).getValue();
            case "Requests":
            case "Hits":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Cache,scope=" + cacheType + ",name=" + metricName),
                        JmxReporter.MeterMBean.class).getCount();
            default:
                throw new RuntimeException("Unknown cache metric name.");

        }
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:34,代码来源:NodeProbe.java

示例4: getProxyMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve Proxy metrics
 * @param scope RangeSlice, Read or Write
 */
public JmxReporter.TimerMBean getProxyMetric(String scope)
{
    try
    {
        return JMX.newMBeanProxy(mbeanServerConn,
                new ObjectName("org.apache.cassandra.metrics:type=ClientRequest,scope=" + scope + ",name=Latency"),
                JmxReporter.TimerMBean.class);
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:18,代码来源:NodeProbe.java

示例5: getCompactionMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve Proxy metrics
 * @param metricName CompletedTasks, PendingTasks, BytesCompacted or TotalCompactionsCompleted.
 */
public Object getCompactionMetric(String metricName)
{
    try
    {
        switch(metricName)
        {
            case "BytesCompacted":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Compaction,name=" + metricName),
                        JmxReporter.CounterMBean.class);
            case "CompletedTasks":
            case "PendingTasks":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Compaction,name=" + metricName),
                        JmxReporter.GaugeMBean.class).getValue();
            case "TotalCompactionsCompleted":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Compaction,name=" + metricName),
                        JmxReporter.MeterMBean.class);
            default:
                throw new RuntimeException("Unknown compaction metric.");
        }
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:33,代码来源:NodeProbe.java

示例6: getStorageMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve Proxy metrics
 * @param metricName Exceptions, Load, TotalHints or TotalHintsInProgress.
 */
public long getStorageMetric(String metricName)
{
    try
    {
        return JMX.newMBeanProxy(mbeanServerConn,
                new ObjectName("org.apache.cassandra.metrics:type=Storage,name=" + metricName),
                JmxReporter.CounterMBean.class).getCount();
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:18,代码来源:NodeProbe.java

示例7: metricPercentilesAsArray

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
public double[] metricPercentilesAsArray(JmxReporter.HistogramMBean metric)
{
    return new double[]{ metric.get50thPercentile(),
            metric.get75thPercentile(),
            metric.get95thPercentile(),
            metric.get98thPercentile(),
            metric.get99thPercentile(),
            metric.getMin(),
            metric.getMax()};
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:11,代码来源:NodeProbe.java

示例8: getCacheMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve cache metrics based on the cache type (KeyCache or RowCache)
 * @param cacheType KeyCache or RowCache
 * @param metricName Capacity, Entries, HitRate, Size, Requests or Hits.
 */
public Object getCacheMetric(String cacheType, String metricName)
{
    try
    {
        switch(metricName)
        {
            case "Capacity":
            case "Entries":
            case "HitRate":
            case "Size":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Cache,scope=" + cacheType + ",name=" + metricName),
                        JmxReporter.GaugeMBean.class).getValue();
            case "Requests":
            case "Hits":
                return JMX.newMBeanProxy(mbeanServerConn,
                        new ObjectName("org.apache.cassandra.metrics:type=Cache,scope=" + cacheType + ",name=" + metricName),
                        JmxReporter.MeterMBean.class).getCount();
            default:
                throw new RuntimeException("Unknown cache metric name.");

        }
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:34,代码来源:NodeProbe.java

示例9: GiraphMetricsRegistry

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Constructor
 * @param registry {@link MetricsRegistry} to use
 * @param reporter {@link JmxReporter} to use
 * @param groupName String grouping for metrics
 * @param type String type name for metrics
 */
protected GiraphMetricsRegistry(MetricsRegistry registry,
    JmxReporter reporter, String groupName, String type) {
  this.registry = registry;
  this.jmxReporter = reporter;
  this.groupName = groupName;
  this.type = type;
  if (jmxReporter != null) {
    jmxReporter.start();
  }
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:18,代码来源:GiraphMetricsRegistry.java

示例10: create

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Create with Hadoop Configuration and superstep number.
 *
 * @param conf Hadoop Configuration to use.
 * @param superstep number of superstep to use as group for metrics.
 * @return new metrics registry
 */
public static SuperstepMetricsRegistry create(GiraphConfiguration conf,
    long superstep) {
  if (conf.metricsEnabled()) {
    MetricsRegistry registry = new MetricsRegistry();
    SuperstepMetricsRegistry superstepMetrics = new SuperstepMetricsRegistry(
        registry, new JmxReporter(registry),
        "giraph.superstep", String.valueOf(superstep));
    superstepMetrics.superstep = superstep;
    return superstepMetrics;
  } else {
    return createFake();
  }
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:21,代码来源:SuperstepMetricsRegistry.java

示例11: registerJMX

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
@Override
public void registerJMX(MBeanServer mbs) throws Exception{
    super.registerJMX(mbs);
    metricsReporter = new JmxReporter(metricsRegistry);
    metricsReporter.start();

    DatabasePropertyManagementImpl.registerJMX(mbs);
}
 
开发者ID:splicemachine,项目名称:spliceengine,代码行数:9,代码来源:MonitoredLifecycleService.java

示例12: getColumnFamilyMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve ColumnFamily metrics
 * @param ks Keyspace for which stats are to be displayed.
 * @param cf ColumnFamily for which stats are to be displayed.
 * @param metricName View {@link org.apache.cassandra.metrics.ColumnFamilyMetrics}.
 */
public Object getColumnFamilyMetric(String ks, String cf, String metricName)
{
    try
    {
        String type = cf.contains(".") ? "IndexColumnFamily": "ColumnFamily";
        ObjectName oName = new ObjectName(String.format("org.apache.cassandra.metrics:type=%s,keyspace=%s,scope=%s,name=%s", type, ks, cf, metricName));
        switch(metricName)
        {
            case "BloomFilterDiskSpaceUsed":
            case "BloomFilterFalsePositives":
            case "BloomFilterFalseRatio":
            case "BloomFilterOffHeapMemoryUsed":
            case "IndexSummaryOffHeapMemoryUsed":
            case "CompressionMetadataOffHeapMemoryUsed":
            case "CompressionRatio":
            case "EstimatedColumnCountHistogram":
            case "EstimatedRowSizeHistogram":
            case "KeyCacheHitRate":
            case "LiveSSTableCount":
            case "MaxRowSize":
            case "MeanRowSize":
            case "MemtableColumnsCount":
            case "MemtableLiveDataSize":
            case "MemtableOffHeapSize":
            case "MinRowSize":
            case "RecentBloomFilterFalsePositives":
            case "RecentBloomFilterFalseRatio":
            case "SnapshotsSize":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.GaugeMBean.class).getValue();
            case "LiveDiskSpaceUsed":
            case "MemtableSwitchCount":
            case "SpeculativeRetries":
            case "TotalDiskSpaceUsed":
            case "WriteTotalLatency":
            case "ReadTotalLatency":
            case "PendingFlushes":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.CounterMBean.class).getCount();
            case "ReadLatency":
            case "CoordinatorReadLatency":
            case "CoordinatorScanLatency":
            case "WriteLatency":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.TimerMBean.class);
            case "LiveScannedHistogram":
            case "SSTablesPerReadHistogram":
            case "TombstoneScannedHistogram":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.HistogramMBean.class);
            default:
                throw new RuntimeException("Unknown column family metric.");
        }
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:62,代码来源:NodeProbe.java

示例13: onMetricsRegistryRegistered

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
@Override
public void onMetricsRegistryRegistered(MetricsRegistry metricsRegistry) {
  new JmxReporter(metricsRegistry).start();
}
 
开发者ID:Hanmourang,项目名称:Pinot,代码行数:5,代码来源:JmxReporterMetricsRegistryRegistrationListener.java

示例14: getColumnFamilyMetric

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
/**
 * Retrieve ColumnFamily metrics
 * @param ks Keyspace for which stats are to be displayed.
 * @param cf ColumnFamily for which stats are to be displayed.
 * @param metricName View {@link org.apache.cassandra.metrics.ColumnFamilyMetrics}.
 */
public Object getColumnFamilyMetric(String ks, String cf, String metricName)
{
    try
    {
        String type = cf.contains(".") ? "IndexColumnFamily": "ColumnFamily";
        ObjectName oName = new ObjectName(String.format("org.apache.cassandra.metrics:type=%s,keyspace=%s,scope=%s,name=%s", type, ks, cf, metricName));
        switch(metricName)
        {
            case "BloomFilterDiskSpaceUsed":
            case "BloomFilterFalsePositives":
            case "BloomFilterFalseRatio":
            case "CompressionRatio":
            case "EstimatedColumnCountHistogram":
            case "EstimatedRowSizeHistogram":
            case "KeyCacheHitRate":
            case "LiveSSTableCount":
            case "MaxRowSize":
            case "MeanRowSize":
            case "MemtableColumnsCount":
            case "MemtableLiveDataSize":
            case "MinRowSize":
            case "RecentBloomFilterFalsePositives":
            case "RecentBloomFilterFalseRatio":
            case "SnapshotsSize":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.GaugeMBean.class).getValue();
            case "LiveDiskSpaceUsed":
            case "MemtableSwitchCount":
            case "SpeculativeRetries":
            case "TotalDiskSpaceUsed":
            case "WriteTotalLatency":
            case "ReadTotalLatency":
            case "PendingFlushes":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.CounterMBean.class).getCount();
            case "ReadLatency":
            case "CoordinatorReadLatency":
            case "CoordinatorScanLatency":
            case "WriteLatency":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.TimerMBean.class);
            case "LiveScannedHistogram":
            case "SSTablesPerReadHistogram":
            case "TombstoneScannedHistogram":
                return JMX.newMBeanProxy(mbeanServerConn, oName, JmxReporter.HistogramMBean.class);
            default:
                throw new RuntimeException("Unknown table metric.");
        }
    }
    catch (MalformedObjectNameException e)
    {
        throw new RuntimeException(e);
    }
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:58,代码来源:NodeProbe.java

示例15: execute

import com.yammer.metrics.reporting.JmxReporter; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
    checkArgument(args.size() == 2, "cfhistograms requires ks and cf args");

    String keyspace = args.get(0);
    String cfname = args.get(1);

    // calculate percentile of row size and column count
    long[] estimatedRowSize = (long[]) probe.getColumnFamilyMetric(keyspace, cfname, "EstimatedRowSizeHistogram");
    long[] estimatedColumnCount = (long[]) probe.getColumnFamilyMetric(keyspace, cfname, "EstimatedColumnCountHistogram");

    long[] bucketOffsets = new EstimatedHistogram().getBucketOffsets();
    EstimatedHistogram rowSizeHist = new EstimatedHistogram(bucketOffsets, estimatedRowSize);
    EstimatedHistogram columnCountHist = new EstimatedHistogram(bucketOffsets, estimatedColumnCount);

    // build arrays to store percentile values
    double[] estimatedRowSizePercentiles = new double[7];
    double[] estimatedColumnCountPercentiles = new double[7];
    double[] offsetPercentiles = new double[]{0.5, 0.75, 0.95, 0.98, 0.99};
    for (int i = 0; i < offsetPercentiles.length; i++)
    {
        estimatedRowSizePercentiles[i] = rowSizeHist.percentile(offsetPercentiles[i]);
        estimatedColumnCountPercentiles[i] = columnCountHist.percentile(offsetPercentiles[i]);
    }

    // min value
    estimatedRowSizePercentiles[5] = rowSizeHist.min();
    estimatedColumnCountPercentiles[5] = columnCountHist.min();
    // max value
    estimatedRowSizePercentiles[6] = rowSizeHist.max();
    estimatedColumnCountPercentiles[6] = columnCountHist.max();

    String[] percentiles = new String[]{"50%", "75%", "95%", "98%", "99%", "Min", "Max"};
    double[] readLatency = probe.metricPercentilesAsArray((JmxReporter.HistogramMBean) probe.getColumnFamilyMetric(keyspace, cfname, "ReadLatency"));
    double[] writeLatency = probe.metricPercentilesAsArray((JmxReporter.TimerMBean) probe.getColumnFamilyMetric(keyspace, cfname, "WriteLatency"));
    double[] sstablesPerRead = probe.metricPercentilesAsArray((JmxReporter.HistogramMBean) probe.getColumnFamilyMetric(keyspace, cfname, "SSTablesPerReadHistogram"));

    System.out.println(format("%s/%s histograms", keyspace, cfname));
    System.out.println(format("%-10s%10s%18s%18s%18s%18s",
            "Percentile", "SSTables", "Write Latency", "Read Latency", "Partition Size", "Cell Count"));
    System.out.println(format("%-10s%10s%18s%18s%18s%18s",
            "", "", "(micros)", "(micros)", "(bytes)", ""));

    for (int i = 0; i < percentiles.length; i++)
    {
        System.out.println(format("%-10s%10.2f%18.2f%18.2f%18.0f%18.0f",
                percentiles[i],
                sstablesPerRead[i],
                writeLatency[i],
                readLatency[i],
                estimatedRowSizePercentiles[i],
                estimatedColumnCountPercentiles[i]));
    }
    System.out.println();
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:57,代码来源:NodeTool.java


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