Package com.codahale.metrics

Examples of com.codahale.metrics.MetricRegistry


    public final Counter totalAggregationRuns;

    public final Timer totalReadTime;

    public Metrics() {
        registry = new MetricRegistry();

        rawInserts = registry.meter(name(MeasurementCollector.class, "rawInserts"));
        batchInsertTime = registry.timer(name(MeasurementCollector.class, "batchInsertTime"));
        totalAggregationTime = registry.timer(name(MeasurementAggregator.class, "totalAggregationTime"));
        twentyFourHourResourceQueryTime = registry.timer(name(MeasurementReader.class, "24HourResourceDataQuery"));
View Full Code Here


    super();
    this.config = config;
    this.isShutdown = new AtomicBoolean(true);
    this.channelMap = new HashMap<InetSocketAddress, List<Channel>>();
    this.channelOpenTimes = new ConcurrentHashMap<Channel, Long>();
    this.metricRegistry = new MetricRegistry();
    this.callbacks = new ConcurrentHashMap<Integer, HelixIPCCallback>();
  }
View Full Code Here

    int batchSize = SEQ_NUM2.incrementAndGet() % 2 == 0 ? 100 : 1;
    DocumentLoader testServer = new SolrServerDocumentLoader(solrServer, batchSize);
    MorphlineContext solrMorphlineContext = new SolrMorphlineContext.Builder()
      .setDocumentLoader(testServer)
      .setExceptionHandler(new FaultTolerance(false, false, SolrServerException.class.getName()))
      .setMetricRegistry(new MetricRegistry()).build();
   
    MorphlineHandlerImpl impl = new MorphlineHandlerImpl();
    impl.setMorphlineContext(solrMorphlineContext);
   
    class MySolrLocator extends SolrLocator { // trick to access protected ctor
View Full Code Here

          context.getBoolean(FaultTolerance.IS_IGNORING_RECOVERABLE_EXCEPTIONS, false),
          context.getString(FaultTolerance.RECOVERABLE_EXCEPTION_CLASSES));
     
      morphlineContext = new MorphlineContext.Builder()
        .setExceptionHandler(faultTolerance)
        .setMetricRegistry(new MetricRegistry())
        .build();
    }
   
    String morphlineFile = context.getString(MORPHLINE_FILE_PARAM);
    String morphlineId = context.getString(MORPHLINE_ID_PARAM);
View Full Code Here

    }

    @Override
    public MetricRegistry getMetricRegistry() {
        if (metricRegistry == null) {
            metricRegistry = new MetricRegistry();
        }

        return metricRegistry;
    }
View Full Code Here

    }

    @Test
    public void testMetricsRegistryFromCamelRegistry() throws Exception {
        // TODO - 12.05.2014, Lauri - is there any better way to set this up?
        MetricRegistry mockRegistry = endpoint.getCamelContext().getRegistry().lookupByNameAndType(MetricsComponent.METRIC_REGISTRY_NAME, MetricRegistry.class);
        Counter mockCounter = Mockito.mock(Counter.class);
        InOrder inOrder = Mockito.inOrder(mockRegistry, mockCounter);
        when(mockRegistry.counter("A")).thenReturn(mockCounter);

        endpoint.expectedMessageCount(1);
        producer.sendBody(new Object());
        endpoint.assertIsSatisfied();
        inOrder.verify(mockRegistry, times(1)).counter("A");
View Full Code Here

    }

    @Test
    public void testGetOrCreateMetricRegistryFoundInCamelRegistry() throws Exception {
        when(camelRegistry.lookupByNameAndType("name", MetricRegistry.class)).thenReturn(metricRegistry);
        MetricRegistry result = component.getOrCreateMetricRegistry(camelRegistry, "name");
        assertThat(result, is(metricRegistry));
        inOrder.verify(camelRegistry, times(1)).lookupByNameAndType("name", MetricRegistry.class);
        inOrder.verifyNoMoreInteractions();
    }
View Full Code Here

    }

    @Test
    public void testGetOrCreateMetricRegistryNotFoundInCamelRegistry() throws Exception {
        when(camelRegistry.lookupByNameAndType("name", MetricRegistry.class)).thenReturn(null);
        MetricRegistry result = component.getOrCreateMetricRegistry(camelRegistry, "name");
        assertThat(result, is(notNullValue()));
        assertThat(result, is(not(metricRegistry)));
        inOrder.verify(camelRegistry, times(1)).lookupByNameAndType("name", MetricRegistry.class);
        inOrder.verifyNoMoreInteractions();
    }
View Full Code Here

    }

    @Test
    public void testGetMetricRegistryFromCamelRegistry() throws Exception {
        when(camelRegistry.lookupByNameAndType("name", MetricRegistry.class)).thenReturn(metricRegistry);
        MetricRegistry result = component.getMetricRegistryFromCamelRegistry(camelRegistry, "name");
        assertThat(result, is(metricRegistry));
        inOrder.verify(camelRegistry, times(1)).lookupByNameAndType("name", MetricRegistry.class);
        inOrder.verifyNoMoreInteractions();
    }
View Full Code Here

        inOrder.verifyNoMoreInteractions();
    }

    @Test
    public void testCreateMetricRegistry() throws Exception {
        MetricRegistry registry = component.createMetricRegistry();
        assertThat(registry, is(notNullValue()));
    }
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.