Codota Logo
Metrics
Code IndexAdd Codota to your IDE (free)

How to use
Metrics
in
com.yammer.metrics

Best Java code snippets using com.yammer.metrics.Metrics (Showing top 20 results out of 540)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: linkedin/cruise-control

private void reportYammerMetrics(long now) throws Exception {
 LOG.debug("Reporting yammer metrics.");
 YammerMetricProcessor.Context context = new YammerMetricProcessor.Context(this, now, _brokerId, _reportingIntervalMs);
 for (Map.Entry<com.yammer.metrics.core.MetricName, Metric> entry : Metrics.defaultRegistry().allMetrics().entrySet()) {
  LOG.trace("Processing yammer metric {}, scope = {}", entry.getKey(), entry.getKey().getScope());
  entry.getValue().processWith(_yammerMetricProcessor, entry.getKey(), context);
 }
 LOG.debug("Finished reporting yammer metrics.");
}
origin: apache/incubator-pinot

/**
 *
 * Return an existing counter if
 *  (a) A counter already exist with the same metric name.
 * Otherwise, creates a new meter and registers
 *
 * @param registry MetricsRegistry
 * @param name metric name
 * @return Counter
 */
public static Counter newCounter(MetricsRegistry registry, MetricName name) {
 if (registry != null) {
  return registry.newCounter(name);
 } else {
  return Metrics.newCounter(name);
 }
}
origin: apache/usergrid

Timer timer = Metrics.newTimer( BcryptCommandTest.class, "hashtimer" );
ConsoleReporter reporter = new ConsoleReporter( Metrics.defaultRegistry(), System.out, MetricPredicate.ALL );
origin: lealone/Lealone

/**
 * Create metrics for given ThreadPoolExecutor.
 *
 * @param executor Thread pool
 * @param path Type of thread pool
 * @param poolName Name of thread pool to identify metrics
 */
public ThreadPoolMetrics(final ThreadPoolExecutor executor, String path, String poolName) {
  this.factory = new ThreadPoolMetricNameFactory("ThreadPools", path, poolName);
  activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>() {
    public Integer value() {
      return executor.getActiveCount();
    }
  });
  totalBlocked = Metrics.newCounter(factory.createMetricName("TotalBlockedTasks"));
  currentBlocked = Metrics.newCounter(factory.createMetricName("CurrentlyBlockedTasks"));
  completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>() {
    public Long value() {
      return executor.getCompletedTaskCount();
    }
  });
  pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>() {
    public Long value() {
      return executor.getTaskCount() - executor.getCompletedTaskCount();
    }
  });
}
origin: com.facebook.presto.cassandra/cassandra-server

public CASClientRequestMetrics(String scope) {
  super(scope);
  contention = Metrics.newHistogram(factory.createMetricName("ContentionHistogram"), true);
  conditionNotMet =  Metrics.newCounter(factory.createMetricName("ConditionNotMet"));
  unfinishedCommit =  Metrics.newCounter(factory.createMetricName("UnfinishedCommit"));
}
origin: apache/incubator-pinot

/**
 *
 * Return an existing timer if
 *  (a) A timer already exist with the same metric name.
 * Otherwise, creates a new timer and registers
 *
 * @param registry MetricsRegistry
 * @param name metric name
 * @param durationUnit TimeUnit for duration
 * @param rateUnit TimeUnit for rate determination
 * @return Timer
 */
public static Timer newTimer(MetricsRegistry registry, MetricName name, TimeUnit durationUnit, TimeUnit rateUnit) {
 if (registry != null) {
  return registry.newTimer(name, durationUnit, rateUnit);
 } else {
  return Metrics.newTimer(name, durationUnit, rateUnit);
 }
}
origin: apache/incubator-pinot

/**
 *
 * Return an existing gauge if
 *  (a) A gauge already exist with the same metric name.
 * Otherwise, creates a new meter and registers
 *
 * @param registry MetricsRegistry
 * @param name metric name
 * @param gauge Underlying gauge to be tracked
 * @return gauge
 */
public static <T> Gauge<T> newGauge(MetricsRegistry registry, MetricName name, Gauge<T> gauge) {
 if (registry != null) {
  return registry.newGauge(name, gauge);
 } else {
  return Metrics.newGauge(name, gauge);
 }
}
origin: apache/incubator-pinot

/**
 *
 * Return an existing meter if
 *  (a) A meter already exist with the same metric name.
 * Otherwise, creates a new meter and registers
 *
 * @param registry MetricsRegistry
 * @param name metric name
 * @param eventType Event Type
 * @param unit TimeUnit for rate determination
 * @return Meter
 */
public static Meter newMeter(MetricsRegistry registry, MetricName name, String eventType, TimeUnit unit) {
 if (registry != null) {
  return registry.newMeter(name, eventType, unit);
 } else {
  return Metrics.newMeter(name, eventType, unit);
 }
}
origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Create LatencyMetrics with given group, type, prefix to append to each metric name, and scope.
 *
 * @param factory MetricName factory to use
 * @param namePrefix Prefix to append to each metric name
 */
public LatencyMetrics(MetricNameFactory factory, String namePrefix)
{
  this.factory = factory;
  this.namePrefix = namePrefix;
  latency = Metrics.newTimer(factory.createMetricName(namePrefix + "Latency"), TimeUnit.MICROSECONDS, TimeUnit.SECONDS);
  totalLatency = Metrics.newCounter(factory.createMetricName(namePrefix + "TotalLatency"));
}

origin: com.sematext.ag/ag-player

/**
 * Constructor.
 * 
 * @param clazz
 *          class for calculating metrics
 */
public BasicMetrics(Class<?> clazz) {
 requests = Metrics.newMeter(clazz, "requests", "requests", TimeUnit.SECONDS);
 timer = Metrics.newTimer(clazz, "responses", TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
}
origin: addthis/metrics-reporter-config

private void runLoop(ReporterConfig config) throws Exception
{
  Counter counter = Metrics.newCounter(getClass(), "counter");
  Meter meter = Metrics.newMeter(getClass(), "meter", "foo", TimeUnit.SECONDS);
  config.enableConsole();
  for (int i=0; i< loops; i++)
  {
    counter.inc();
    meter.mark();
    Thread.sleep(1000);
    log.debug("runLoop tick");
  }
  log.info("Done with sample data loop");
}
origin: com.facebook.presto.cassandra/cassandra-server

  public FileCacheMetrics()
  {
    hits = Metrics.newMeter(factory.createMetricName("Hits"), "hits", TimeUnit.SECONDS);
    requests = Metrics.newMeter(factory.createMetricName("Requests"), "requests", TimeUnit.SECONDS);
    hitRate = Metrics.newGauge(factory.createMetricName("HitRate"), new RatioGauge()
    {
      protected double getNumerator()
      {
        return hits.count();
      }

      protected double getDenominator()
      {
        return requests.count();
      }
    });
    size = Metrics.newGauge(factory.createMetricName("Size"), new Gauge<Long>()
    {
      public Long value()
      {
        return FileCacheService.instance.sizeInBytes();
      }
    });
  }
}
origin: apache/incubator-pinot

/**
 *
 * Return an existing histogram if
 *  (a) A histogram already exist with the same metric name.
 * Otherwise, creates a new meter and registers
 *
 * @param registry MetricsRegistry
 * @param name metric name
 * @param biased (true if uniform distribution, otherwise exponential weighted)
 * @return histogram
 */
public static Histogram newHistogram(MetricsRegistry registry, MetricName name, boolean biased) {
 if (registry != null) {
  return registry.newHistogram(name, biased);
 } else {
  return Metrics.newHistogram(name, biased);
 }
}
origin: com.senseidb/sensei-core

 IndexingMetrics(int partition) {
  MetricName docsIndexedName = new MetricName(MetricsConstants.Domain, "meter", "docs-indexed",
    "indexer");
  docsIndexedMetric = Metrics.newMeter(docsIndexedName, "indexing", TimeUnit.SECONDS);
  MetricName docsLeftoverName = new MetricName(MetricsConstants.Domain, "meter",
    "docs-leftover", "indexer");
  docsLeftoverMetric = Metrics.newMeter(docsLeftoverName, "indexing", TimeUnit.SECONDS);
  MetricName flushTimeName = new MetricName(MetricsConstants.Domain, "histogram", "flush-time",
    "indexer");
  flushTimeHistogram = Metrics.newHistogram(flushTimeName, false);
 }
}
origin: com.wavefront/proxy

public FilebeatIngester(LogsIngester logsIngester, Supplier<Long> currentMillis) {
 this.logsIngester = logsIngester;
 this.received = Metrics.newCounter(new MetricName("logsharvesting", "", "filebeat-received"));
 this.malformed = Metrics.newCounter(new MetricName("logsharvesting", "", "filebeat-malformed"));
 this.drift = Metrics.newHistogram(new MetricName("logsharvesting", "", "filebeat-drift"));
 this.currentMillis = currentMillis;
}
origin: urbanairship/statshtable

SHTimerMetric(TimeUnit durationUnit, TimeUnit rateUnit) {
  t = Metrics.newTimer(this.getClass(),"Timer",durationUnit, rateUnit);
}
origin: lealone/Lealone

activeTasks = Metrics.newGauge(factory.createMetricName("ActiveTasks"), new Gauge<Integer>() {
  public Integer value() {
    return executor.getActiveCount();
pendingTasks = Metrics.newGauge(factory.createMetricName("PendingTasks"), new Gauge<Long>() {
  public Long value() {
    return executor.getPendingTasks();
totalBlocked = Metrics.newGauge(factory.createMetricName("TotalBlockedTasks"), new Gauge<Integer>() {
  public Integer value() {
    return executor.getTotalBlockedTasks();
currentBlocked = Metrics.newGauge(factory.createMetricName("CurrentlyBlockedTasks"), new Gauge<Long>() {
  public Long value() {
    return (long) executor.getCurrentlyBlockedTasks();
completedTasks = Metrics.newGauge(factory.createMetricName("CompletedTasks"), new Gauge<Long>() {
  public Long value() {
    return executor.getCompletedTasks();
origin: lealone/Lealone

/**
 * Create metrics for given connection pool.
 *
 * @param ip IP address to use for metrics label
 */
public ConnectionMetrics(NetEndpoint ip) {
  // ipv6 addresses will contain colons, which are invalid in a JMX ObjectName
  String address = ip.getHostAddress().replaceAll(":", ".");
  factory = new DefaultNameFactory("Connection", address);
  timeouts = Metrics.newMeter(factory.createMetricName("Timeouts"), "timeouts", TimeUnit.SECONDS);
}
origin: com.wavefront/proxy

ReportingObjectQueueWrapper(ObjectQueue<T> backingQueue, String title) {
 this.addCounter = Metrics.newCounter(new MetricName("tape." + title, "", "add"));
 this.removeCounter = Metrics.newCounter(new MetricName("tape." + title, "", "remove"));
 this.peekCounter = Metrics.newCounter(new MetricName("tape." + title, "", "peek"));
 Metrics.newGauge(new MetricName("tape." + title, "", "size"),
   new Gauge<Integer>() {
    @Override
    public Integer value() {
     return backingQueue.size();
    }
   });
 this.backingQueue = backingQueue;
}
origin: facebookarchive/hive-io-experimental

/**
 * Constructor
 *
 * @param name String name
 * @param printPeriod how often to print
 */
public MetricsObserver(String name, int printPeriod) {
 TimeUnit durationUnit = TimeUnit.MICROSECONDS;
 TimeUnit rateUnit = TimeUnit.MILLISECONDS;
 this.printPeriod = printPeriod;
 readTimer = Metrics.newTimer(new MetricName(name, "", "reads"),
   durationUnit, rateUnit);
 readSuccessRatio =
   new CounterRatioGauge(Metrics.newCounter(new MetricName(name, "", "successes")),
     Metrics.newCounter(new MetricName(name, "", "-reads")));
 parseTimer = Metrics.newTimer(new MetricName(name, "", "parses"),
   durationUnit, rateUnit);
}
com.yammer.metricsMetrics

Javadoc

A set of factory methods for creating centrally registered metric instances.

Most used methods

  • defaultRegistry
    Returns the (static) default registry.
  • newCounter
    Creates a new com.yammer.metrics.core.Counter and registers it under the given class and name.
  • newTimer
  • newMeter
  • newGauge
    Given a new com.yammer.metrics.core.Gauge, registers it under the given class and name.
  • newHistogram
    Creates a new com.yammer.metrics.core.Histogram and registers it under the given class and name.
  • shutdown
    Shuts down all thread pools for the default registry.

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • addToBackStack (FragmentTransaction)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JFileChooser (javax.swing)
  • JLabel (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now