Package com.codahale.metrics

Examples of com.codahale.metrics.MetricRegistry


public class SystemJobManagerTest {

    @Test
    public void testGetRunningJobs() throws Exception {
        SystemJobManager manager = new SystemJobManager(mock(ActivityWriter.class), new MetricRegistry());

        LongRunningJob job1 = new LongRunningJob(1);
        LongRunningJob job2 = new LongRunningJob(1);

        String jobID1 = manager.submit(job1);
View Full Code Here


            LOG.error("Injector could not be created, exiting! (Please include the previous stacktraces in bug reports.)");
            System.exit(1);
        }

        // This is holding all our metrics.
        final MetricRegistry metrics = injector.getInstance(MetricRegistry.class);

        // Report metrics via JMX.
        final JmxReporter reporter = JmxReporter.forRegistry(metrics).build();
        reporter.start();
View Full Code Here

    public MetricReporter build() {
        if (!succcesfulConfigured) {
            throw new IllegalStateException("MetricReporterBuilder is not successfully configured.");
        }

        final MetricRegistry metricRegistry = new MetricRegistry();
        final Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));

        final Builder builder =
            GraphiteReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL);
View Full Code Here

    private MetricRegistry registry;

    @Override
    protected AppDescriptor configure() {
        this.registry = new MetricRegistry();

        final DefaultResourceConfig config = new DefaultResourceConfig();
        config.getSingletons().add(new InstrumentedResourceMethodDispatchAdapter(registry));
        config.getClasses().add(InstrumentedResource.class);
View Full Code Here

        this.meterNamesByStatusCode = meterNamesByStatusCode;
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        final MetricRegistry metricsRegistry = getMetricsFactory(filterConfig);

        String metricName = filterConfig.getInitParameter(METRIC_PREFIX);
        if(metricName == null || metricName.isEmpty()) {
            metricName = getClass().getName();
        }

        this.metersByStatusCode = new ConcurrentHashMap<Integer, Meter>(meterNamesByStatusCode
                .size());
        for (Entry<Integer, String> entry : meterNamesByStatusCode.entrySet()) {
            metersByStatusCode.put(entry.getKey(),
                    metricsRegistry.meter(name(metricName, entry.getValue())));
        }
        this.otherMeter = metricsRegistry.meter(name(metricName,
                                                     otherMetricName));
        this.activeRequests = metricsRegistry.counter(name(metricName,
                                                           "activeRequests"));
        this.requestTimer = metricsRegistry.timer(name(metricName,
                                                       "requests"));

    }
View Full Code Here

                                                       "requests"));

    }

    private MetricRegistry getMetricsFactory(FilterConfig filterConfig) {
        final MetricRegistry metricsRegistry;

        final Object o = filterConfig.getServletContext().getAttribute(this.registryAttribute);
        if (o instanceof MetricRegistry) {
            metricsRegistry = (MetricRegistry) o;
        } else {
            metricsRegistry = new MetricRegistry();
        }
        return metricsRegistry;
    }
View Full Code Here

    private MetricRegistry registry;

    @Override
    protected Application configure() {
        this.registry = new MetricRegistry();

        ResourceConfig config = new ResourceConfig();
        config = config.register(new MetricsFeature(this.registry));
        config = config.register(InstrumentedResource.class);
View Full Code Here

    if (pool != nullpool.shutdown();
  }

  @SuppressWarnings("unchecked")
  private void initMetrics() throws Exception {
    metrics = new MetricRegistry();
    // configuration
    metricsOutputDir = conf.get(SLSConfiguration.METRICS_OUTPUT_DIR);
    int metricsWebAddressPort = conf.getInt(
            SLSConfiguration.METRICS_WEB_ADDRESS_PORT,
            SLSConfiguration.METRICS_WEB_ADDRESS_PORT_DEFAULT);
View Full Code Here

  public static void main(String[] args) {
    ScheduledReporter r0 = null;
    ScheduledReporter r1 = null;
    try {
      final MetricRegistry registry = new MetricRegistry();
      r0 = startConsoleReporter(registry);
      r1 = startInfluxdbReporter(registry);

      final Meter mymeter0 = registry.meter("MyMeter.0");
      for (int i = 0; i < 100; i++) {
        mymeter0.mark();
        mymeter0.mark(Math.round(Math.random() * 100.0));
        Thread.sleep(Math.round(Math.random() * 1000.0));
      }
View Full Code Here

    if (pool != nullpool.shutdown();
  }

  @SuppressWarnings("unchecked")
  private void initMetrics() throws Exception {
    metrics = new MetricRegistry();
    // configuration
    metricsOutputDir = conf.get(SLSConfiguration.METRICS_OUTPUT_DIR);
    int metricsWebAddressPort = conf.getInt(
            SLSConfiguration.METRICS_WEB_ADDRESS_PORT,
            SLSConfiguration.METRICS_WEB_ADDRESS_PORT_DEFAULT);
View Full Code Here

TOP

Related Classes of com.codahale.metrics.MetricRegistry

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.