Package com.codahale.metrics

Examples of com.codahale.metrics.MetricRegistry


    private InstrumentedWithMetered meteredInstance;
    private MetricRegistry registry;

    @Before
    public void setup() {
        this.registry = new MetricRegistry();
        final Matcher<? super TypeLiteral<?>> matcher = new AbstractMatcher<TypeLiteral<?>>() {
            @Override
            public boolean matches(final TypeLiteral<?> typeLiteral) {
                return InstrumentedWithMetered.class.isAssignableFrom(typeLiteral.getRawType());
            }
View Full Code Here


    private InstrumentedWithMetered instance;
    private MetricRegistry registry;

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

    private InstrumentedWithCounter instance;
    private MetricRegistry registry;

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

        }
    }

    private void copyIndexingMetrics3ToCounters(Context context) {
        for (String name : SharedMetricRegistries.names()) {
            MetricRegistry metricRegistry = SharedMetricRegistries.getOrCreate(name);
            for (Map.Entry<String, com.codahale.metrics.Counter> entry : metricRegistry.getCounters().entrySet()) {
                addCounting(context, entry.getKey(), entry.getValue(), 1);
            }
            for (Map.Entry<String, com.codahale.metrics.Histogram> entry : metricRegistry.getHistograms().entrySet()) {
                addCounting(context, entry.getKey(), entry.getValue(), 1);
            }
            for (Map.Entry<String, com.codahale.metrics.Meter> entry : metricRegistry.getMeters().entrySet()) {
                addCounting(context, entry.getKey(), entry.getValue(), 1);
            }
            for (Map.Entry<String, com.codahale.metrics.Timer> entry : metricRegistry.getTimers().entrySet()) {
                long nanosPerMilliSec = 1000 * 1000;
                addCounting(context, entry.getKey(), entry.getValue(), nanosPerMilliSec);
            }
        }
    }
View Full Code Here

                        + MorphlineResultToSolrMapper.MORPHLINE_FILE_PARAM, null);
        }
        this.morphlineFileAndId = morphlineFile + "@" + morphlineId;
       
        // share metric registry across threads for better (aggregate) reporting
        MetricRegistry metricRegistry = SharedMetricRegistries.getOrCreate(morphlineFileAndId);
       
        this.morphlineContext = (HBaseMorphlineContext)new HBaseMorphlineContext.Builder()
            .setExceptionHandler(faultTolerance)
            .setMetricRegistry(metricRegistry)
            .build();
View Full Code Here

      Thread.sleep(8000);

      ds.close();

      final MetricRegistry registry = new MetricRegistry();
      final Histogram histogram = registry.histogram("foo");

      for (final FastWorker w : workers) {
         histogram.update(w.iterations);
      }
     
View Full Code Here

public class TestMetrics
{
   @Test
   public void testMetricWait() throws SQLException
   {
      MetricRegistry metricRegistry = new MetricRegistry();

      HikariConfig config = new HikariConfig();
      config.setMinimumIdle(1);
      config.setMaximumPoolSize(1);
      config.setMetricRegistry(metricRegistry);
      config.setPoolName("test");
      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);
      try {
         ds.getConnection().close();

         Timer timer = metricRegistry.getTimers(new MetricFilter() {
            /** {@inheritDoc} */
            @Override
            public boolean matches(String name, Metric metric)
            {
               return "test.pool.Wait".equals(MetricRegistry.name("test", "pool", "Wait"));
View Full Code Here

   }

   @Test
   public void testMetricUsage() throws SQLException
   {
      MetricRegistry metricRegistry = new MetricRegistry();

      HikariConfig config = new HikariConfig();
      config.setMinimumIdle(1);
      config.setMaximumPoolSize(1);
      config.setMetricRegistry(metricRegistry);
      config.setPoolName("test");
      config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

      HikariDataSource ds = new HikariDataSource(config);
      try {
         Connection connection = ds.getConnection();
         PoolUtilities.quietlySleep(250L);
         connection.close();

         Histogram histo = metricRegistry.getHistograms(new MetricFilter() {
            /** {@inheritDoc} */
            @Override
            public boolean matches(String name, Metric metric)
            {
               return "test.pool.Usage".equals(MetricRegistry.name("test", "pool", "Usage"));
View Full Code Here

        @Override
        protected Values compute() {
            final Values values = this.execContext.getValues();

            final Processor<In, Out> process = this.node.processor;
            final MetricRegistry registry = this.node.metricRegistry;
            final String name = ProcessorGraphNode.class.getName() + "_compute():" + process.getClass();
            Timer.Context timerContext = registry.timer(name).time();
            try {
                In inputParameter = ProcessorUtils.populateInputParameter(process, values);

                Out output;
                try {
View Full Code Here

        final TestProcessor processor = new TestProcessor("p");
        processor.getInputMapperBiMap().put("pp", "prop");

        final ProcessorDependencyGraph graph = new ProcessorDependencyGraph();
        MetricRegistry registry = new MetricRegistry();
        graph.addRoot(new ProcessorGraphNode(processor, registry));
        final ProcessorDependencyGraph.ProcessorGraphForkJoinTask task = graph.createTask(values);

        // no exception ... good
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.