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

How to use
Histogram
in
com.codahale.metrics

Best Java code snippets using com.codahale.metrics.Histogram (Showing top 20 results out of 2,304)

Refine searchRefine arrow

  • Snapshot
  • Meter
  • MetricRegistry
  • Timer
  • Counter
origin: io.dropwizard.metrics/metrics-core

  @Override
  public void run() {
    running.inc();
    final Timer.Context context = duration.time();
    try {
      command.run();
    } finally {
      final long elapsed = context.stop();
      running.dec();
      completed.mark();
      if (elapsed > periodInNanos) {
        scheduledOverrun.inc();
      }
      percentOfPeriod.update((100L * elapsed) / periodInNanos);
    }
  }
}
origin: apache/hbase

 private void printHistogram(Histogram histogram) {
  Snapshot snapshot = histogram.getSnapshot();
  output.printf(locale, "               min = %d%n", snapshot.getMin());
  output.printf(locale, "               max = %d%n", snapshot.getMax());
  output.printf(locale, "              mean = %2.2f%n", snapshot.getMean());
  output.printf(locale, "            stddev = %2.2f%n", snapshot.getStdDev());
  output.printf(locale, "            median = %2.2f%n", snapshot.getMedian());
  output.printf(locale, "              75%% <= %2.2f%n", snapshot.get75thPercentile());
  output.printf(locale, "              95%% <= %2.2f%n", snapshot.get95thPercentile());
  output.printf(locale, "              98%% <= %2.2f%n", snapshot.get98thPercentile());
  output.printf(locale, "              99%% <= %2.2f%n", snapshot.get99thPercentile());
  output.printf(locale, "            99.9%% <= %2.2f%n", snapshot.get999thPercentile());
  output.printf(locale, "             count = %d%n", histogram.getCount());
 }
}
origin: micrometer-metrics/micrometer

@Setup(Level.Iteration)
public void setup() {
  registry = new MetricRegistry();
  histogram = registry.histogram("histogram");
  histogramSlidingTimeWindow =
      registry.register("slidingTimeWindowHistogram",
          new Histogram(new SlidingTimeWindowReservoir(10, TimeUnit.SECONDS)));
  histogramUniform =
      registry.register("uniformHistogram",
          new Histogram(new UniformReservoir()));
}
origin: stagemonitor/stagemonitor

  public void writeValues(Histogram histogram, JsonGenerator jg) throws IOException {
    final Snapshot snapshot = histogram.getSnapshot();
    jg.writeNumberField("count", histogram.getCount());
    writeHistogramSnapshot(snapshot, jg);
  }
}
origin: Graylog2/graylog2-server

public static Map<String, Object> buildHistogramMap(Histogram h) {
  Map<String, Object> metrics = Maps.newHashMap();
  if (h == null) {
    return metrics;
  }
  Map<String, Object> time = Maps.newHashMap();
  time.put("max", h.getSnapshot().getMax());
  time.put("min", h.getSnapshot().getMin());
  time.put("mean", (long) h.getSnapshot().getMean());
  time.put("95th_percentile", (long) h.getSnapshot().get95thPercentile());
  time.put("98th_percentile", (long) h.getSnapshot().get98thPercentile());
  time.put("99th_percentile", (long) h.getSnapshot().get99thPercentile());
  time.put("std_dev", (long) h.getSnapshot().getStdDev());
  metrics.put("time", time);
  metrics.put("count", h.getCount());
  return metrics;
}
origin: apache/incubator-gobblin

totalRecordsCounter.inc();
recordProcessRateMeter.mark();
recordSizesHistogram.update((this.rand.nextLong() & Long.MAX_VALUE) % 5000l);
recordProcessTimeTimer.update(processTime, TimeUnit.MILLISECONDS);
origin: apache/incubator-gobblin

com.codahale.metrics.Counter recordsProcessedCounter = new com.codahale.metrics.Counter();
recordsProcessedCounter.inc(10l);
Histogram recordSizeDistributionHistogram = new Histogram(new ExponentiallyDecayingReservoir());
recordSizeDistributionHistogram.update(1);
recordSizeDistributionHistogram.update(2);
recordSizeDistributionHistogram.update(3);
Meter recordProcessRateMeter = new Meter();
recordProcessRateMeter.mark(1l);
recordProcessRateMeter.mark(2l);
recordProcessRateMeter.mark(3l);
Timer totalDurationTimer = new Timer();
totalDurationTimer.update(1, TimeUnit.SECONDS);
totalDurationTimer.update(2, TimeUnit.SECONDS);
totalDurationTimer.update(3, TimeUnit.SECONDS);
Mockito.verify(this.queueSize).setValue(1000);
recordsProcessedCounter.inc(5l);
recordSizeDistributionHistogram.update(4);
recordProcessRateMeter.mark(4l);
totalDurationTimer.update(4, TimeUnit.SECONDS);
origin: Graylog2/graylog2-server

@Override
protected void run() throws Exception {
  try {
    requestedReadCount = metricRegistry.register(name(this.getClass(), "requestedReadCount"), new HdrHistogram(processBuffer.getRingBufferSize() + 1, 3));
  } catch (IllegalArgumentException e) {
    log.warn("Metric already exists", e);
    requestedReadCount.update(remainingCapacity);
    final List<Journal.JournalReadEntry> encodedRawMessages = journal.read(remainingCapacity);
    if (encodedRawMessages.isEmpty()) {
        readBlocked.inc();
        journalFilled.acquire();
      } catch (InterruptedException ignored) {
      readMessages.mark(encodedRawMessages.size());
      log.debug("Processing {} messages from journal.", encodedRawMessages.size());
      for (final Journal.JournalReadEntry encodedRawMessage : encodedRawMessages) {
origin: apache/hbase

/** @return a summary of {@code hist}. */
public static String getHistogramReport(final Histogram hist) {
 Snapshot sn = hist.getSnapshot();
 return "mean=" + DOUBLE_FORMAT.format(sn.getMean()) +
   ", min=" + DOUBLE_FORMAT.format(sn.getMin()) +
   ", max=" + DOUBLE_FORMAT.format(sn.getMax()) +
   ", stdDev=" + DOUBLE_FORMAT.format(sn.getStdDev()) +
   ", 50th=" + DOUBLE_FORMAT.format(sn.getMedian()) +
   ", 75th=" + DOUBLE_FORMAT.format(sn.get75thPercentile()) +
   ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
   ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile()) +
   ", 99.9th=" + DOUBLE_FORMAT.format(sn.get999thPercentile()) +
   ", 99.99th=" + DOUBLE_FORMAT.format(sn.getValue(0.9999)) +
   ", 99.999th=" + DOUBLE_FORMAT.format(sn.getValue(0.99999));
}
origin: Graylog2/graylog2-server

private void flush(List<Map.Entry<IndexSet, Message>> messages) {
  // never try to flush an empty buffer
  if (messages.isEmpty()) {
    return;
  }
  activeFlushThreads.incrementAndGet();
  if (log.isDebugEnabled()) {
    log.debug("Starting flushing {} messages, flush threads active {}",
        messages.size(),
        activeFlushThreads.get());
  }
  try (Timer.Context ignored = processTime.time()) {
    lastFlushTime.set(System.nanoTime());
    writeMessageEntries(messages);
    batchSize.update(messages.size());
    bufferFlushes.mark();
  } catch (Exception e) {
    log.error("Unable to flush message buffer", e);
    bufferFlushFailures.mark();
  }
  activeFlushThreads.decrementAndGet();
  log.debug("Flushing {} messages completed", messages.size());
}
origin: apache/kylin

Entry<String, Counter> counter = counterIterator.next();
MetricsInfo info = Interns.info(counter.getKey(), EMPTY_STRING);
builder.addCounter(info, counter.getValue().getCount());
final Histogram histogram = entry.getValue();
addSnapshot(builder, name, EMPTY_STRING, histogram.getSnapshot(), histogram.getCount());
final Meter meter = meterEntry.getValue();
addMeter(builder, name, EMPTY_STRING, meter.getCount(), meter.getMeanRate(), meter.getOneMinuteRate(),
    meter.getFiveMinuteRate(), meter.getFifteenMinuteRate());
final String name = timerEntry.getKey();
final Timer timer = timerEntry.getValue();
final Snapshot snapshot = timer.getSnapshot();
addMeter(builder, name, EMPTY_STRING, timer.getCount(), timer.getMeanRate(), timer.getOneMinuteRate(),
    timer.getFiveMinuteRate(), timer.getFifteenMinuteRate());
origin: io.dropwizard.metrics/metrics-core

  private void update(long duration) {
    if (duration >= 0) {
      histogram.update(duration);
      meter.mark();
    }
  }
}
origin: apache/incubator-gobblin

  OutputStreamReporter.Factory.newBuilder().outputTo(this.stream).build(new Properties());
counter.inc();
meter.mark(2);
histogram.update(1);
histogram.update(1);
histogram.update(2);
origin: biezhi/java-library-examples

  public static void main(String[] args) throws InterruptedException {
    MetricRegistry  registry = new MetricRegistry();
    ConsoleReporter reporter = ConsoleReporter.forRegistry(registry).build();
    reporter.start(1, TimeUnit.SECONDS);
    Histogram histogram = new Histogram(new ExponentiallyDecayingReservoir());
    registry.register(MetricRegistry.name(HistogramExample.class, "request", "histogram"), histogram);

    while (true) {
      Thread.sleep(1000);
      histogram.update(random.nextInt(100000));
    }
  }
}
origin: apache/hbase

/** @return an abbreviated summary of {@code hist}. */
public static String getShortHistogramReport(final Histogram hist) {
 Snapshot sn = hist.getSnapshot();
 return "mean=" + DOUBLE_FORMAT.format(sn.getMean()) +
   ", min=" + DOUBLE_FORMAT.format(sn.getMin()) +
   ", max=" + DOUBLE_FORMAT.format(sn.getMax()) +
   ", stdDev=" + DOUBLE_FORMAT.format(sn.getStdDev()) +
   ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) +
   ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile());
}
origin: HotelsDotCom/styx

private void updateChannelPerThreadCounters(int amount) {
  Thread thread = Thread.currentThread();
  Counter channelCount = this.metricRegistry.counter(name(counterPrefix(thread), "registered-channel-count"));
  channelCount.inc(amount);
  Histogram histogram = metricRegistry.histogram(name(counterPrefix(thread), "channels"));
  histogram.update(channelCount.getCount());
}
origin: thinkaurelius/titan

private void recordSliceMetrics(StoreTransaction txh, List<Entry> row) {
  if (!txh.getConfiguration().hasGroupName())
    return;
  String p = txh.getConfiguration().getGroupName();
  final MetricManager mgr = MetricManager.INSTANCE;
  mgr.getCounter(p, metricsStoreName, M_GET_SLICE, M_ENTRIES_COUNT).inc(row.size());
  mgr.getHistogram(p, metricsStoreName, M_GET_SLICE, M_ENTRIES_HISTO).update(row.size());
}
origin: weibocom/motan

  .histogram(HISTOGRAM_NAME).getSnapshot();
    "[motan-accessStatistic] app: {} module: {} item: {} total_count: {} slow_count: {} p75: {} p95: {} p98: {} p99: {} p999: {} biz_excp: {} other_excp: {} avg_time: {}ms biz_time: {}ms avg_tps: {} max_tps: {} min_tps: {} ",
    application, module, keys[0], result.totalCount, result.slowCount,
    mbFormat.format(snapshot.get75thPercentile()), mbFormat.format(snapshot.get95thPercentile()),
    mbFormat.format(snapshot.get98thPercentile()), mbFormat.format(snapshot.get99thPercentile()),
    mbFormat.format(snapshot.get999thPercentile()), result.bizExceptionCount, result.otherExceptionCount,
    mbFormat.format(result.costTime / result.totalCount), mbFormat.format(result.bizTime / result.totalCount),
Snapshot snapshot =
    InternalMetricsFactory.getRegistryInstance(entry.getKey())
        .histogram(HISTOGRAM_NAME).getSnapshot();
if (totalResult.totalCount > 0) {
  LoggerUtil.accessStatsLog(
origin: Graylog2/graylog2-server

private void recordEsMetrics(JestResult jestResult, @Nullable TimeRange range) {
  esTotalSearchesCounter.inc();
  final long tookMs = tookMsFromSearchResult(jestResult);
  esRequestTimer.update(tookMs, TimeUnit.MILLISECONDS);
  if (range != null) {
    esTimeRangeHistogram.update(TimeRanges.toSeconds(range));
  }
}
origin: apache/zookeeper

  public Map<String, Object> values() {
    Map<String, Object> m = new LinkedHashMap<>();
    m.putAll(counter.values());
    m.put("p50_" + name, Math.round(this.histogram.getSnapshot().getMedian()));
    m.put("p95_" + name, Math.round(this.histogram.getSnapshot().get95thPercentile()));
    m.put("p99_" + name, Math.round(this.histogram.getSnapshot().get99thPercentile()));
    m.put("p999_" + name, Math.round(this.histogram.getSnapshot().get999thPercentile()));
    return m;
  }
}
com.codahale.metricsHistogram

Javadoc

A metric which calculates the distribution of a value.

Most used methods

  • update
    Adds a recorded value.
  • getSnapshot
  • getCount
    Returns the number of values recorded.
  • <init>
    Creates a new Histogram with the given reservoir.
  • Printer
  • ReadValue
  • addWord
  • getBinSize
  • getBins
  • getList
  • getNumBins
  • getNumBins

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top Sublime Text 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