Tabnine Logo
Slf4jReporter
Code IndexAdd Tabnine to your IDE (free)

How to use
Slf4jReporter
in
com.codahale.metrics

Best Java code snippets using com.codahale.metrics.Slf4jReporter (Showing top 20 results out of 666)

Refine searchRefine arrow

  • Slf4jReporter.Builder
  • LoggerFactory
origin: thinkaurelius/titan

/**
 * Create a {@link Slf4jReporter} attached to the Titan Metrics registry.
 * <p>
 * If {@code loggerName} is null, or if it is non-null but
 * {@link LoggerFactory#getLogger(loggerName)} returns null, then Metrics's
 * default Slf4j logger name is used instead.
 *
 * @param reportInterval
 *            time to wait between writing metrics to the Slf4j
 *            logger
 * @param loggerName
 *            the name of the Slf4j logger that receives metrics
 */
public synchronized void addSlf4jReporter(Duration reportInterval, String loggerName) {
  if (null != slf4jReporter) {
    log.debug("Metrics Slf4jReporter already active; not creating another");
    return;
  }
  Slf4jReporter.Builder b = Slf4jReporter.forRegistry(getRegistry());
  if (null != loggerName) {
    Logger l = LoggerFactory.getLogger(loggerName);
    if (null != l) {
      b.outputTo(l);
    } else {
      log.error("Logger with name {} could not be obtained", loggerName);
    }
  }
  slf4jReporter = b.build();
  slf4jReporter.start(reportInterval.toMillis(), TimeUnit.MILLISECONDS);
}
origin: apache/usergrid

@After
public void printReport() {
  reporter.report();
  reporter.stop();
}
origin: apache/drill

 private static Slf4jReporter getLogReporter() {
  if (METRICS_LOG_OUTPUT_ENABLED) {
   Slf4jReporter reporter = Slf4jReporter.forRegistry(REGISTRY)
     .outputTo(logger)
     .convertRatesTo(TimeUnit.SECONDS)
     .convertDurationsTo(TimeUnit.MILLISECONDS)
     .build();
   reporter.start(METRICS_LOG_OUTPUT_INTERVAL, TimeUnit.SECONDS);
   return reporter;
  }
  return null;
 }
}
origin: ryantenney/metrics-spring

@Override
protected Slf4jReporter createInstance() {
  final Slf4jReporter.Builder reporter = Slf4jReporter.forRegistry(getMetricRegistry());
  if (hasProperty(DURATION_UNIT)) {
    reporter.convertDurationsTo(getProperty(DURATION_UNIT, TimeUnit.class));
  }
  if (hasProperty(RATE_UNIT)) {
    reporter.convertRatesTo(getProperty(RATE_UNIT, TimeUnit.class));
  }
  reporter.filter(getMetricFilter());
  reporter.prefixedWith(getPrefix());
  if (hasProperty(MARKER)) {
    reporter.markWith(MarkerFactory.getMarker(getProperty(MARKER)));
  }
  if (hasProperty(LOGGER)) {
    reporter.outputTo(LoggerFactory.getLogger(getProperty(LOGGER)));
  }
  if (hasProperty(LEVEL)) {
    reporter.withLoggingLevel(getProperty(LEVEL, LoggingLevel.class));
  }
  return reporter.build();
}
origin: org.apache.spark/spark-kvstore_2.11

Slf4jReporter.forRegistry(metrics).outputTo(LoggerFactory.getLogger(LevelDBBenchmark.class))
 .build().report();
origin: dropwizard/dropwizard

  @Override
  public ScheduledReporter build(MetricRegistry registry) {
    final Slf4jReporter.Builder builder = Slf4jReporter.forRegistry(registry)
                              .convertDurationsTo(getDurationUnit())
                              .convertRatesTo(getRateUnit())
                              .filter(getFilter())
                              .outputTo(getLogger());
    if (markerName != null) {
      builder.markWith(MarkerFactory.getMarker(markerName));
    }

    return builder.build();
  }
}
origin: com.vladmihalcea.flexy-pool/flexy-dropwizard-metrics

/**
 * Start Log Reporter
 */
@Override
public void start() {
  if (slf4jReporter != null) {
    slf4jReporter.start(metricLogReporterMillis, TimeUnit.MILLISECONDS);
  }
}
origin: io.engineblock/eb-core

public void reportToLog() {
  logger.info("-- BEGIN METRICS DETAIL --");
  Slf4jReporter reporter = Slf4jReporter.forRegistry(ActivityMetrics.getMetricRegistry())
      .convertDurationsTo(TimeUnit.MICROSECONDS)
      .convertRatesTo(TimeUnit.SECONDS)
      .filter(MetricFilter.ALL)
      .outputTo(logger)
      .build();
  reporter.report();
  logger.info("-- END METRICS DETAIL --");
}
origin: thinkaurelius/titan

/**
 * Stop a {@link Slf4jReporter} previously created by a call to
 * {@link #addSlf4jReporter(long, String)} and release it for GC. Idempotent
 * between calls to the associated add method. Does nothing before the first
 * call to the associated add method.
 */
public synchronized void removeSlf4jReporter() {
  if (null != slf4jReporter)
    slf4jReporter.stop();
  slf4jReporter = null;
}
origin: apache/eagle

  @Override
  public void report() {
    reporter.report();
  }
}
origin: apache/eagle

@Override
public void stop() {
  reporter.stop();
  reporter.close();
}
origin: hypercube1024/firefly

public DefaultMetricReporterFactory() {
  this.metricRegistry = new MetricRegistry();
  this.scheduledReporter = Slf4jReporter.forRegistry(metricRegistry)
                     .outputTo(LoggerFactory.getLogger("firefly-monitor"))
                     .convertRatesTo(TimeUnit.SECONDS)
                     .convertDurationsTo(TimeUnit.MILLISECONDS)
                     .build();
}
origin: apache/usergrid

@Before
public void startReporting() {
  reporter = Slf4jReporter.forRegistry( registry ).outputTo( LOG ).convertRatesTo( TimeUnit.SECONDS )
             .convertDurationsTo( TimeUnit.MILLISECONDS ).build();
  reporter.start( 10, TimeUnit.SECONDS );
}
origin: NationalSecurityAgency/emissary

/**
 * Create manager using specified configuration
 * 
 * @param conf the configuration to use
 */
public MetricsManager(final Configurator conf) {
  this.conf = conf;
  init();
  this.reporter = Slf4jReporter.forRegistry(this.metrics).build();
}
origin: com.vladmihalcea.flexy-pool/flexy-codahale-metrics

/**
 * Start Log Reporter
 */
@Override
public void start() {
  if (slf4jReporter != null) {
    slf4jReporter.start(metricLogReporterMillis, TimeUnit.MILLISECONDS);
  }
}
origin: JanusGraph/janusgraph

/**
 * Stop a {@link Slf4jReporter} previously created by a call to
 * {@link #addSlf4jReporter(Duration, String)} and release it for GC. Idempotent
 * between calls to the associated add method. Does nothing before the first
 * call to the associated add method.
 */
public synchronized void removeSlf4jReporter() {
  if (null != slf4jReporter)
    slf4jReporter.stop();
  slf4jReporter = null;
}
origin: jordw/heftydb

public void logMetrics() {
  reporter.report();
}
origin: JanusGraph/janusgraph

/**
 * Create a {@link Slf4jReporter} attached to the JanusGraph Metrics registry.
 * <p>
 * If {@code loggerName} is null, or if it is non-null but
 * {@link LoggerFactory#getLogger(Class loggerName)} returns null, then Metrics's
 * default Slf4j logger name is used instead.
 *
 * @param reportInterval
 *            time to wait between writing metrics to the Slf4j
 *            logger
 * @param loggerName
 *            the name of the Slf4j logger that receives metrics
 */
public synchronized void addSlf4jReporter(Duration reportInterval, String loggerName) {
  if (null != slf4jReporter) {
    log.debug("Metrics Slf4jReporter already active; not creating another");
    return;
  }
  Slf4jReporter.Builder b = Slf4jReporter.forRegistry(getRegistry());
  if (null != loggerName) {
    Logger l = LoggerFactory.getLogger(loggerName);
    if (null != l) {
      b.outputTo(l);
    } else {
      log.error("Logger with name {} could not be obtained", loggerName);
    }
  }
  slf4jReporter = b.build();
  slf4jReporter.start(reportInterval.toMillis(), TimeUnit.MILLISECONDS);
}
origin: hypercube1024/firefly

public DefaultMetricReporterFactory() {
  this.metricRegistry = new MetricRegistry();
  this.scheduledReporter = Slf4jReporter.forRegistry(metricRegistry)
                     .outputTo(LoggerFactory.getLogger("firefly-monitor"))
                     .convertRatesTo(TimeUnit.SECONDS)
                     .convertDurationsTo(TimeUnit.MILLISECONDS)
                     .build();
}
origin: apache/usergrid

@Before
public void startReporting() {
  reporter = Slf4jReporter.forRegistry( registry ).outputTo( logger )
      .convertRatesTo( TimeUnit.SECONDS )
      .convertDurationsTo( TimeUnit.MILLISECONDS ).build();
  reporter.start( 10, TimeUnit.SECONDS );
}
com.codahale.metricsSlf4jReporter

Javadoc

A reporter class for logging metrics values to a SLF4J Logger periodically, similar to ConsoleReporter or CsvReporter, but using the SLF4J framework instead. It also supports specifying a Marker instance that can be used by custom appenders and filters for the bound logging toolkit to further process metrics reports.

Most used methods

  • forRegistry
    Returns a new Builder for Slf4jReporter.
  • start
  • stop
  • report
  • <init>
  • close
  • convertDuration
  • convertRate
  • getDurationUnit
  • getRateUnit
  • logCounter
  • logGauge
  • logCounter,
  • logGauge,
  • logHistogram,
  • logMeter,
  • logTimer,
  • prefix

Popular in Java

  • Reactive rest calls using spring rest template
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JOptionPane (javax.swing)
  • Top plugins for Android Studio
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