Tabnine Logo
MetricsFactory.getInstance
Code IndexAdd Tabnine to your IDE (free)

How to use
getInstance
method
in
uk.gov.dstl.baleen.core.metrics.MetricsFactory

Best Java code snippets using uk.gov.dstl.baleen.core.metrics.MetricsFactory.getInstance (Showing top 20 results out of 315)

origin: uk.gov.dstl.baleen/baleen-core

/**
 * Get a new metrics provider for a specific class.
 *
 * @param prefix
 * @param clazz
 * @return
 */
public static Metrics getMetrics(String prefix, Class<?> clazz) {
 return new Metrics(getInstance(), prefix, clazz);
}
origin: uk.gov.dstl.baleen/baleen-core

/**
 * Get a new metrics provider for a specific class, without a prefix.
 *
 * @param clazz
 * @return
 */
public static Metrics getMetrics(Class<?> clazz) {
 return new Metrics(getInstance(), clazz);
}
origin: dstl/baleen

/**
 * Get a new metrics provider for a specific class.
 *
 * @param prefix
 * @param clazz
 * @return
 */
public static Metrics getMetrics(String prefix, Class<?> clazz) {
 return new Metrics(getInstance(), prefix, clazz);
}
origin: dstl/baleen

/**
 * Get a new metrics provider for a specific class, without a prefix.
 *
 * @param clazz
 * @return
 */
public static Metrics getMetrics(Class<?> clazz) {
 return new Metrics(getInstance(), clazz);
}
origin: uk.gov.dstl.baleen/baleen-core

/** Start timing the processing of a document */
public void startDocumentProcess() {
 finishDocumentProcess(); // Check we've finished the timing of the previous document
 documentTimerContext =
   MetricsFactory.getInstance().getTimer(pipelineName, DOCUMENT_TIMER).time();
}
origin: dstl/baleen

/** Start timing the processing of a document */
public void startDocumentProcess() {
 finishDocumentProcess(); // Check we've finished the timing of the previous document
 documentTimerContext =
   MetricsFactory.getInstance().getTimer(pipelineName, DOCUMENT_TIMER).time();
}
origin: uk.gov.dstl.baleen/baleen-core

/** Shutdown the sub components. */
public synchronized void shutdown() {
 if (started) {
  LOGGER.info("Shutting down");
  started = false;
  List<AbstractBaleenComponent> components =
    Arrays.asList(pipelineManager, jobManager, webApi, logging);
  for (AbstractBaleenComponent component : components) {
   if (component != null) {
    try {
     component.stop();
    } catch (BaleenException e) {
     LOGGER.error("Failed to stop " + component.getClass().getSimpleName(), e);
    }
   }
  }
  MetricsFactory metrics = MetricsFactory.getInstance();
  if (metrics != null) {
   metrics.stop();
  }
  LOGGER.info("Shutdown complete");
 }
}
origin: dstl/baleen

/** Shutdown the sub components. */
public synchronized void shutdown() {
 if (started) {
  LOGGER.info("Shutting down");
  started = false;
  List<AbstractBaleenComponent> components =
    Arrays.asList(pipelineManager, jobManager, webApi, logging);
  for (AbstractBaleenComponent component : components) {
   if (component != null) {
    try {
     component.stop();
    } catch (BaleenException e) {
     LOGGER.error("Failed to stop " + component.getClass().getSimpleName(), e);
    }
   }
  }
  MetricsFactory metrics = MetricsFactory.getInstance();
  if (metrics != null) {
   metrics.stop();
  }
  LOGGER.info("Shutdown complete");
 }
}
origin: uk.gov.dstl.baleen/baleen-uima

@Override
public final void getNext(final JCas jCas) throws IOException, CollectionException {
 getMonitor().startFunction("getNext");
 MetricsFactory.getInstance()
   .getPipelineMetrics(monitor.getPipelineName())
   .startDocumentProcess();
 jCas.setDocumentText(JobSettings.class.getSimpleName());
 jCas.setDocumentLanguage("en");
 final JobSettings settings = new JobSettings(jCas);
 for (final Map.Entry<String, String> e : config.entrySet()) {
  settings.set(e.getKey(), e.getValue());
 }
 getMonitor().finishFunction("getNext");
}
origin: dstl/baleen

@Override
public final void getNext(final JCas jCas) throws IOException, CollectionException {
 getMonitor().startFunction("getNext");
 MetricsFactory.getInstance()
   .getPipelineMetrics(monitor.getPipelineName())
   .startDocumentProcess();
 jCas.setDocumentText(JobSettings.class.getSimpleName());
 jCas.setDocumentLanguage("en");
 final JobSettings settings = new JobSettings(jCas);
 for (final Map.Entry<String, String> e : config.entrySet()) {
  settings.set(e.getKey(), e.getValue());
 }
 getMonitor().finishFunction("getNext");
}
origin: dstl/baleen

@Before
public void before() {
 // We need to clear the registry
 MetricsFactory.getInstance().removeAll();
}
origin: uk.gov.dstl.baleen/baleen-core

MetricsFactory metrics = MetricsFactory.getInstance();
metrics.configure(configuration);
metrics.start();
origin: dstl/baleen

MetricsFactory metrics = MetricsFactory.getInstance();
metrics.configure(configuration);
metrics.start();
origin: uk.gov.dstl.baleen/baleen-uima

@Override
public final void getNext(JCas jCas) throws IOException, CollectionException {
 monitor.startFunction("getNext");
 MetricsFactory.getInstance()
   .getPipelineMetrics(monitor.getPipelineName())
   .startDocumentProcess();
 doGetNext(jCas);
 monitor.finishFunction("getNext");
 monitor.persistCounts();
}
origin: dstl/baleen

@Override
public final void getNext(JCas jCas) throws IOException, CollectionException {
 monitor.startFunction("getNext");
 MetricsFactory.getInstance()
   .getPipelineMetrics(monitor.getPipelineName())
   .startDocumentProcess();
 doGetNext(jCas);
 monitor.finishFunction("getNext");
 monitor.persistCounts();
}
origin: dstl/baleen

@Test
public void testInstance() {
 assertNotNull(MetricsFactory.getInstance());
 Metrics m1 = MetricsFactory.getMetrics(MetricsFactoryTest.class);
 Metrics m2 = MetricsFactory.getMetrics("Testing", MetricsFactoryTest.class);
 assertTrue(m1.getBase().contains(MetricsFactoryTest.class.getCanonicalName()));
 assertTrue(m2.getBase().contains(MetricsFactoryTest.class.getCanonicalName()));
 assertTrue(m2.getBase().startsWith("Testing"));
}
origin: dstl/baleen

 @Test
 public void test() throws Exception {
  PipelineMetrics pm = MetricsFactory.getInstance().getPipelineMetrics(PIPELINE_NAME);

  assertEquals(PIPELINE_NAME, pm.getPipelineName());

  pm.startDocumentProcess();
  Thread.sleep(10);
  pm.finishDocumentProcess();

  Timer t = MetricsFactory.getInstance().getTimer(PIPELINE_NAME, "documentProcessingTime");
  assertEquals(1, t.getCount());
  assertTrue(t.getMeanRate() > 0);

  assertEquals(pm, MetricsFactory.getInstance().getPipelineMetrics(PIPELINE_NAME));
 }
}
origin: uk.gov.dstl.baleen/baleen-core

  new InstrumentedAppender(MetricsFactory.getInstance().getRegistry());
instrumentedAppender.setContext(context);
instrumentedAppender.start();
origin: dstl/baleen

  new InstrumentedAppender(MetricsFactory.getInstance().getRegistry());
instrumentedAppender.setContext(context);
instrumentedAppender.start();
origin: dstl/baleen

@Test
public void testDoesntCrash() {
 MetricsFactory factory = MetricsFactory.getInstance();
 factory.getRegistry().addListener(new LoggingMetricListener());
 assertNotNull(factory.getCounter(LoggingMetricListenerTest.class, "a"));
 assertNotNull(factory.getHistogram(LoggingMetricListenerTest.class, "b"));
 assertNotNull(factory.getMeter(LoggingMetricListenerTest.class, "c"));
 assertNotNull(factory.getTimer(LoggingMetricListenerTest.class, "d"));
 factory.removeAll();
}
uk.gov.dstl.baleen.core.metricsMetricsFactorygetInstance

Javadoc

Get singleton instance

Popular methods of MetricsFactory

  • getMetrics
    Get a new metrics provider for a specific class.
  • configure
    Configure the instance.
  • getCounter
    Get or create a metric counter, with default naming.
  • getHistogram
    Get or create a metric histogram, with default naming.
  • getMeter
    Get or create a metric meter, with default naming.
  • getPipelineMetrics
    Get an instance of PipelineMetrics for the given pipeline name
  • getRegistry
    Get the underlying metrics registry.
  • getTimer
    Get or create a metric timer, with default naming.
  • makeName
    Create a name using the default scheme.
  • removeAll
    Remove all metrics from the registry
  • start
  • stop
  • start,
  • stop,
  • <init>,
  • report

Popular in Java

  • Updating database using SQL prepared statement
  • runOnUiThread (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now