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

How to use
newCounter
method
in
com.yammer.metrics.Metrics

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

  • 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: 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: 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: addthis/hydra

public CountingHealthCheck(int maxFailures, String meterName, boolean resetOnSuccess) {
  super(maxFailures);
  this.failedCheckCounter = Metrics.newCounter(CountingHealthCheck.class, meterName, null);
  this.resetOnSuccess = resetOnSuccess;
}
origin: com.facebook.presto.cassandra/cassandra-server

  public Counter load(InetAddress address)
  {
    return Metrics.newCounter(factory.createMetricName("Hints_created-" + address.getHostAddress().replace(':', '.')));
  }
});
origin: com.wavefront/proxy

public HistogramLineIngester(Collection<ChannelHandler> handlers, int port) {
 this.handlers = new ArrayList<>(handlers);
 this.port = port;
 this.connectionsAccepted = Metrics.newCounter(new TaggedMetricName("listeners", "connections.accepted",
   "port", String.valueOf(port)));
 this.connectionsIdleClosed = Metrics.newCounter(new TaggedMetricName("listeners", "connections.idle.closed",
   "port", String.valueOf(port)));
}
origin: com.wavefront/java-lib

private void initMetrics(int port) {
 this.connectionsAccepted = Metrics.newCounter(new TaggedMetricName("listeners", "connections.accepted",
   "port", String.valueOf(port)));
 this.connectionsIdleClosed = Metrics.newCounter(new TaggedMetricName("listeners", "connections.idle.closed",
   "port", String.valueOf(port)));
}
origin: com.wavefront/proxy

public ReportPointTimestampInRangeFilter(final int hoursInPastAllowed, final int hoursInFutureAllowed) {
 this.hoursInPastAllowed = hoursInPastAllowed;
 this.hoursInFutureAllowed = hoursInFutureAllowed;
 this.outOfRangePointTimes = Metrics.newCounter(new MetricName("point", "", "badtime"));
}
origin: com.wavefront/proxy

public RawLogsIngester(LogsIngester logsIngester, int port, Supplier<Long> now) {
 this.logsIngester = logsIngester;
 this.port = port;
 this.now = now;
 this.received = Metrics.newCounter(new MetricName("logsharvesting", "", "raw-received"));
 this.connectionsAccepted = Metrics.newCounter(new TaggedMetricName("listeners", "connections.accepted",
   "port", String.valueOf(port)));
 this.connectionsIdleClosed = Metrics.newCounter(new TaggedMetricName("listeners", "connections.idle.closed",
   "port", String.valueOf(port)));
}
origin: rackerlabs/atom-hopper

  private void incrementCounterForFeed(String feedName) {

    if (!counterMap.containsKey(feedName)) {
      synchronized (counterMap) {
        if (!counterMap.containsKey(feedName)) {
          Counter counter = Metrics.newCounter(MongodbFeedPublisher.class, "entries-created-for-" + feedName);
          counterMap.put(feedName, counter);
        }
      }
    }

    counterMap.get(feedName).inc();
  }
}
origin: rackerlabs/atom-hopper

private void incrementCounterForFeed(String feedName) {
  if (!counterMap.containsKey(feedName)) {
    synchronized (counterMap) {
      if (!counterMap.containsKey(feedName)) {
        Counter counter = Metrics.newCounter( JdbcFeedPublisher.class, "entries-created-for-" + feedName );
        counterMap.put(feedName, counter);
      }
    }
  }
  counterMap.get(feedName).inc();
}
origin: rackerlabs/atom-hopper

  private void incrementCounterForFeed(String feedName) {

    if (!counterMap.containsKey(feedName)) {
      synchronized (counterMap) {
        if (!counterMap.containsKey(feedName)) {
          Counter counter = Metrics.newCounter(HibernateFeedPublisher.class, "entries-created-for-" + feedName);
          counterMap.put(feedName, counter);
        }
      }
    }

    counterMap.get(feedName).inc();
  }
}
origin: rackerlabs/atom-hopper

  private void incrementCounterForFeed(String feedName) {

    if (!counterMap.containsKey(feedName)) {
      synchronized (counterMap) {
        if (!counterMap.containsKey(feedName)) {
          Counter counter = Metrics.newCounter(PostgresFeedPublisher.class, "entries-created-for-" + feedName);
          counterMap.put(feedName, counter);
        }
      }
    }

    counterMap.get(feedName).inc();
  }
}
origin: wavefrontHQ/java

public ReportPointTimestampInRangeFilter(final int hoursInPastAllowed, final int hoursInFutureAllowed) {
 this.hoursInPastAllowed = hoursInPastAllowed;
 this.hoursInFutureAllowed = hoursInFutureAllowed;
 this.outOfRangePointTimes = Metrics.newCounter(new MetricName("point", "", "badtime"));
}
origin: com.facebook.presto.cassandra/cassandra-server

  public StreamingMetrics(final InetAddress peer)
  {
    MetricNameFactory factory = new DefaultNameFactory("Streaming", peer.getHostAddress().replace(':', '.'));
    incomingBytes = Metrics.newCounter(factory.createMetricName("IncomingBytes"));
    outgoingBytes= Metrics.newCounter(factory.createMetricName("OutgoingBytes"));
  }
}
origin: com.wavefront/proxy

public ReportSourceTagHandlerImpl(final String handle, final int blockedItemsPerBatch,
                 final Collection<SenderTask> senderTasks) {
 super(ReportableEntityType.SOURCE_TAG, handle, blockedItemsPerBatch, new ReportSourceTagSerializer(), senderTasks);
 this.attemptedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "sent"));
 this.queuedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "queued"));
 statisticOutputExecutor.scheduleAtFixedRate(this::printStats, 10, 10, TimeUnit.SECONDS);
 statisticOutputExecutor.scheduleAtFixedRate(this::printTotal, 1, 1, TimeUnit.MINUTES);
}
origin: wavefrontHQ/java

public ReportSourceTagHandlerImpl(final String handle, final int blockedItemsPerBatch,
                 final Collection<SenderTask> senderTasks) {
 super(ReportableEntityType.SOURCE_TAG, handle, blockedItemsPerBatch, new ReportSourceTagSerializer(), senderTasks);
 this.attemptedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "sent"));
 this.queuedCounter = Metrics.newCounter(new MetricName("sourceTags." + handle, "", "queued"));
 statisticOutputExecutor.scheduleAtFixedRate(this::printStats, 10, 10, TimeUnit.SECONDS);
 statisticOutputExecutor.scheduleAtFixedRate(this::printTotal, 1, 1, TimeUnit.MINUTES);
}
origin: com.senseidb/sensei-core

 private void initCounters() {
  for (int currentPartition : _core.getPartitions()) {
   partitionCalls.put(
    currentPartition,
    Metrics.newCounter(AbstractSenseiCoreService.class, "partitionCallsForPartition"
      + currentPartition + "andNode" + _core.getNodeId()));
  }
 }
}
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: wavefrontHQ/java

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: 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"));
}
com.yammer.metricsMetricsnewCounter

Javadoc

Creates a new com.yammer.metrics.core.Counter and registers it under the given metric name.

Popular methods of Metrics

  • defaultRegistry
    Returns the (static) default registry.
  • 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
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • runOnUiThread (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JComboBox (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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