Package com.yammer.metrics.core

Examples of com.yammer.metrics.core.MetricsRegistry


   ClusterId clusterId = new ClusterId("appliction", "cluster");

   @SuppressWarnings("unchecked")
   long getStatValue(StatsCollectorCoda statCollector, String metricName)
   {
      MetricsRegistry metricReg = statCollector.getMetricsRegistry();
      Object meter = metricReg.allMetrics().get(statCollector.createName(metricName));
      if (com.yammer.metrics.core.Gauge.class.isAssignableFrom(meter.getClass()))
         return ((com.yammer.metrics.core.Gauge<Long>)metricReg.allMetrics().get(statCollector.createName(metricName))).value();
      else if (com.yammer.metrics.core.Histogram.class.isAssignableFrom(meter.getClass()))
      {
         final com.yammer.metrics.core.Histogram h = (com.yammer.metrics.core.Histogram)metricReg.allMetrics().get(statCollector.createName(metricName));
         return Math.round(h.count() * h.mean());
      }
      else
         return ((Metered)metricReg.allMetrics().get(statCollector.createName(metricName))).count();
   }
View Full Code Here


* @see GaugeInjectionListener
*/
public class CodahaleMetricsModule extends AbstractModule {
  @Override
  protected void configure() {
    final MetricsRegistry metricsRegistry = createMetricsRegistry();

    CodahaleMetricRegistry registry = new CodahaleMetricRegistry(metricsRegistry);
    bind(MetricRegistry.class).toInstance(registry);

    bind(MetricReporter.class).to(CodahaleMetricsReporter.class).asEagerSingleton();
View Full Code Here

  }

  @Override
  public void run() {
    try {
      MetricsRegistry registry = getMetricsRegistry();
      Map<MetricName, Metric> allMetrics = registry.allMetrics();
      for (Entry<MetricName, Metric> entry : allMetrics.entrySet()) {
        entry.getValue().processWith(this, entry.getKey(), _metrics);
      }
    } catch (Exception e) {
      LOG.error("Unknown error during metrics processing.", e);
View Full Code Here

   * @param type String type to use for metrics.
   * @return new metrics registry
   */
  public static GiraphMetricsRegistry createWithOptional(String groupName,
    String type) {
    MetricsRegistry registry = new MetricsRegistry();
    return new GiraphMetricsRegistry(registry, new JmxReporter(registry),
        groupName, type);
  }
View Full Code Here

   * @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;
View Full Code Here

        // Nothing to do
    }

    @Override
    public void run(CachingBundleConfiguration configuration, Environment environment) {
        MetricsRegistry metricsRegistry = Metrics.defaultRegistry();
        Function<String, Optional<String>> cacheControlMapper = configuration.getCacheControl().buildMapper();
        ResponseCache responseCache = configuration.getCache().buildCache(metricsRegistry);

        environment.addProvider(new CacheResourceMethodDispatchAdapter(responseCache, cacheControlMapper));
View Full Code Here

    this.maxItems = maxItems;
  }

  public void run() {

    MetricsRegistry registry = Metrics.defaultRegistry();

    ServerBootstrap bootstrap = new ServerBootstrap(
        new NioServerSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool()));
View Full Code Here

        context.setAttribute(MonitorManager.HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());
        context.setAttribute(MonitorManager.CRITICAL_HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());
        context.setAttribute(MonitorManager.WARNING_HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());
        context.setAttribute(MonitorManager.EXPENSIVE_HEALTH_CHECK_REGISTRY, new HealthCheckRegistry());

        MetricsRegistry metricsRegistry = new MetricsRegistry();
        context.setAttribute(MonitorManager.METRICS_REGISTRY, metricsRegistry);
        context.setAttribute(DefaultWebappMetricsFilter.REGISTRY_ATTRIBUTE, metricsRegistry);
    }
View Full Code Here

   * @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;
View Full Code Here

   * @param type String type to use for metrics.
   * @return new metrics registry
   */
  public static GiraphMetricsRegistry createWithOptional(String groupName,
    String type) {
    MetricsRegistry registry = new MetricsRegistry();
    return new GiraphMetricsRegistry(registry, new JmxReporter(registry),
        groupName, type);
  }
View Full Code Here

TOP

Related Classes of com.yammer.metrics.core.MetricsRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.