Package com.codahale.metrics

Examples of com.codahale.metrics.MetricRegistry


  DrillConfig c = DrillConfig.create();

  @SuppressWarnings("deprecation")
private SimpleRootExec doTest(final DrillbitContext bitContext, UserClientConnection connection, String plan_path) throws Exception{
    new NonStrictExpectations(){{
      bitContext.getMetrics(); result = new MetricRegistry();
      bitContext.getAllocator(); result = new TopLevelAllocator();
      bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
      bitContext.getConfig(); result = c;
    }};
View Full Code Here


  private SimpleRootExec doLogicalTest(final BootStrapContext context, UserClientConnection connection, String file,
      ClusterCoordinator coord, DataConnectionCreator com, DistributedCache cache, Controller controller, WorkEventBus workBus) throws Exception {
    new NonStrictExpectations() {
      {
        context.getMetrics();
        result = new MetricRegistry();
        context.getAllocator();
        result = new TopLevelAllocator();
        context.getConfig();
        result = c;
      }
View Full Code Here

  private SimpleRootExec doPhysicalTest(final DrillbitContext bitContext, UserClientConnection connection, String file)
      throws Exception {
    new NonStrictExpectations() {
      {
        bitContext.getMetrics();
        result = new MetricRegistry();
        bitContext.getAllocator();
        result = new TopLevelAllocator();
        bitContext.getConfig();
        result = c;
      }
View Full Code Here

  public void testFilter(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable{
//    System.out.println(System.getProperty("java.class.path"));


    new NonStrictExpectations(){{
      bitContext.getMetrics(); result = new MetricRegistry();
      bitContext.getAllocator(); result = new TopLevelAllocator();
      bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
      bitContext.getConfig(); result = c;
    }};
View Full Code Here

  }

  @Test
  public void testSV4Filter(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable{
    new NonStrictExpectations(){{
      bitContext.getMetrics(); result = new MetricRegistry();
      bitContext.getAllocator(); result = new TopLevelAllocator();
      bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
      bitContext.getConfig(); result = c;
    }};
View Full Code Here

public class Server {

    public static void main(String[] args) throws Exception {

        // configure reporter
        final MetricRegistry metrics = new MetricRegistry();
        ElasticsearchReporter reporter = ElasticsearchReporter.forRegistry(metrics)
                                            // support for several es nodes
                                            .hosts("localhost:9200", "localhost:9201")
                                            // just create an index, no date format, means one index only
                                            .index("metrics")
                                            .indexDateFormat(null)
                                            // define a percolation check on all metrics
                                            .percolationFilter(MetricFilter.ALL)
                                            .percolationNotifier(new SystemOutNotifier())
                                            //.percolationNotifier(new HttpNotifier())
                                            .build();
        // usually you set this to one minute
        reporter.start(10, TimeUnit.SECONDS);

        // start up background thread
        ExecutorService executorService = Executors.newSingleThreadExecutor();
        executorService.submit(new StreamMeetupComTask(metrics));

        // start up web app
        get(new Route("/") {
            @Override
            public Object handle(Request request, Response response) {
                return "this is /";
            }
        });

        post(new Route("/checkout") {
            @Override
            public Object handle(Request request, Response response) {
                // emulate calling external payment API
                Timer.Context timer = metrics.timer("payment.runtime").time();

                try {
                    Thread.sleep(new Random().nextInt(1000));
                } catch (InterruptedException e) {
                    // ignore
                } finally {
                    timer.stop();
                }

                response.redirect("/");
                return null;
            }
        });

        before(new Filter() {
            @Override
            public void handle(Request request, Response response) {
                metrics.counter("http.connections.concurrent").inc();
                metrics.meter("http.connections.requests").mark();
                metrics.counter("http.connections.stats." + request.raw().getMethod()).inc();
                metrics.counter("http.connections.stats." + request.raw().getMethod() + "." + request.pathInfo()).inc();
            }
        });

        after(new Filter() {
            @Override
            public void handle(Request request, Response response) {
                metrics.counter("http.connections.concurrent").dec();
            }
        });
    }
View Full Code Here

@Deprecated
public abstract class TenacityTest {
    @Before
    public void testInitialization() {
        resetHystrixPlugins();
        HystrixPlugins.getInstance().registerMetricsPublisher(new HystrixCodaHaleMetricsPublisher(new MetricRegistry()));
        ConfigurationManager
                .getConfigInstance()
                .setProperty("hystrix.command.default.metrics.healthSnapshot.intervalInMilliseconds", "1");
    }
View Full Code Here

    private InstrumentedWithGauge instance;
    private MetricRegistry registry;

    @Before
    public void setup() {
        this.registry = new MetricRegistry();
        final Injector injector = Guice.createInjector(new MetricsInstrumentationModule(registry));
        this.instance = injector.getInstance(InstrumentedWithGauge.class);
    }
View Full Code Here

    private InstrumentedWithTimed instance;
    private MetricRegistry registry;

    @Before
    public void setup() {
        this.registry = new MetricRegistry();
        final Injector injector = Guice.createInjector(new MetricsInstrumentationModule(registry));
        this.instance = injector.getInstance(InstrumentedWithTimed.class);
    }
View Full Code Here

    private InstrumentedWithExceptionMetered instance;
    private MetricRegistry registry;

    @Before
    public void setup() {
        this.registry = new MetricRegistry();
        final Injector injector = Guice.createInjector(new MetricsInstrumentationModule(registry));
        this.instance = injector.getInstance(InstrumentedWithExceptionMetered.class);
    }
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.