com.codahale.metrics.Histogram.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(224)

本文整理了Java中com.codahale.metrics.Histogram.<init>()方法的一些代码示例,展示了Histogram.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.<init>()方法的具体详情如下:
包路径:com.codahale.metrics.Histogram
类名称:Histogram
方法名:<init>

Histogram.<init>介绍

[英]Creates a new Histogram with the given reservoir.
[中]使用给定的库创建一个新的直方图。

代码示例

代码示例来源:origin: apache/storm

public Histogram registerHistogram(String name, Reservoir reservoir) {
  return registry.histogram(name, () -> new Histogram(reservoir));
}

代码示例来源:origin: io.dropwizard.metrics/metrics-core

/**
 * Creates a new {@link Timer} that uses the given {@link Reservoir} and {@link Clock}.
 *
 * @param reservoir the {@link Reservoir} implementation the timer should use
 * @param clock     the {@link Clock} implementation the timer should use
 */
public Timer(Reservoir reservoir, Clock clock) {
  this.meter = new Meter(clock);
  this.clock = clock;
  this.histogram = new Histogram(reservoir);
}

代码示例来源:origin: apache/zookeeper

public AvgMinMaxPercentileCounter(String name) {
  this.name = name;
  this.counter = new AvgMinMaxCounter(this.name);
  reservoir = new ResettableUniformReservoir();
  histogram = new Histogram(reservoir);
}

代码示例来源:origin: apache/kylin

@Override
  public Histogram load(String key) {
    Histogram histogram = new Histogram(new ExponentiallyDecayingReservoir());
    metricRegistry.register(key, histogram);
    return histogram;
  }
});

代码示例来源:origin: stagemonitor/stagemonitor

@Override
public Histogram newMetric() {
  return new Histogram(new ExponentiallyDecayingReservoir());
}

代码示例来源: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: io.dropwizard.metrics/metrics-core

@Override
public Histogram newMetric() {
  return new Histogram(new ExponentiallyDecayingReservoir());
}

代码示例来源:origin: AxonFramework/AxonFramework

/**
 * Creates a capacity monitor with the given time window. Uses the provided clock
 * to measure process time per message.
 *
 * @param window The length of the window to measure the capacity over
 * @param timeUnit The time unit of the time window
 * @param clock The clock used to measure the process time per message
 */
public CapacityMonitor(long window, TimeUnit timeUnit, Clock clock) {
  SlidingTimeWindowReservoir slidingTimeWindowReservoir = new SlidingTimeWindowReservoir(window, timeUnit, clock);
  this.processedDurationHistogram = new Histogram(slidingTimeWindowReservoir);
  this.timeUnit = timeUnit;
  this.window = window;
  this.clock = clock;
  this.capacity = new CapacityGauge();
}

代码示例来源:origin: alibaba/jstorm

public static Histogram metricSnapshot2Histogram(MetricSnapshot snapshot) {
  Histogram histogram;
  if (metricAccurateCal) {
    histogram = new Histogram(new ExponentiallyDecayingReservoir());
    byte[] points = snapshot.get_points();
    int len = snapshot.get_pointSize();
    updateHistogramPoints(histogram, points, len);
  } else {
    histogram = new Histogram(new JAverageReservoir());
    JAverageSnapshot averageSnapshot = (JAverageSnapshot) histogram.getSnapshot();
    averageSnapshot.setMetricSnapshot(snapshot.deepCopy());
  }
  return histogram;
}

代码示例来源:origin: apache/incubator-gobblin

recordsProcessedCounter.inc(10l);
Histogram recordSizeDistributionHistogram = new Histogram(new ExponentiallyDecayingReservoir());
recordSizeDistributionHistogram.update(1);
recordSizeDistributionHistogram.update(2);

代码示例来源:origin: apache/incubator-gobblin

recordsProcessedCounter.inc(10l);
Histogram recordSizeDistributionHistogram = new Histogram(new ExponentiallyDecayingReservoir());
recordSizeDistributionHistogram.update(1);
recordSizeDistributionHistogram.update(2);

代码示例来源:origin: HubSpot/Singularity

public ReconciliationState startReconciliation() {
 final long taskReconciliationStartedAt = System.currentTimeMillis();
 if (!isRunningReconciliation.compareAndSet(false, true)) {
  LOG.info("Reconciliation is already running, NOT starting a new reconciliation process");
  return ReconciliationState.ALREADY_RUNNING;
 }
 if (!schedulerClient.isRunning()) {
  LOG.trace("Not running reconciliation - no active scheduler present");
  isRunningReconciliation.set(false);
  return ReconciliationState.NO_DRIVER;
 }
 final List<SingularityTaskId> activeTaskIds = taskManager.getActiveTaskIds();
 LOG.info("Starting a reconciliation cycle - {} current active tasks", activeTaskIds.size());
 schedulerClient.reconcile(Collections.emptyList());
 scheduleReconciliationCheck(taskReconciliationStartedAt, activeTaskIds, 0, new Histogram(new UniformReservoir()));
 return ReconciliationState.STARTED;
}

代码示例来源:origin: com.codahale.metrics/metrics-core

/**
 * Creates a new {@link Timer} that uses the given {@link Reservoir} and {@link Clock}.
 *
 * @param reservoir the {@link Reservoir} implementation the timer should use
 * @param clock  the {@link Clock} implementation the timer should use
 */
public Timer(Reservoir reservoir, Clock clock) {
  this.meter = new Meter(clock);
  this.clock = clock;
  this.histogram = new Histogram(reservoir);
}

代码示例来源:origin: org.apache.fluo/fluo-core

public static synchronized Histogram addHistogram(FluoConfiguration config,
  MetricRegistry registry, String name) {
 Histogram histogram = registry.getHistograms().get(name);
 if (histogram == null) {
  histogram = new Histogram(getConfiguredReservoir(config));
  registry.register(name, histogram);
 }
 return histogram;
}

代码示例来源:origin: snazy/ohc

public MergeableTimerSource()
{
  this.clock = Clock.defaultClock();
  this.count = new AtomicLong();
  this.histogram = new AtomicReference<>(new Histogram(new UniformReservoir()));
}

代码示例来源:origin: astefanutti/metrics-cdi

@Produces
private static Histogram histogram(InjectionPoint ip, MetricRegistry registry, MetricName metricName, MetricsExtension extension) {
  String name = metricName.of(ip);
  return extension.<BiFunction<String, Class<? extends Metric>, Optional<Reservoir>>>getParameter(ReservoirFunction)
    .flatMap(function -> function.apply(name, Histogram.class))
    .map(reservoir -> registry.histogram(name, () -> new Histogram(reservoir)))
    .orElseGet(() -> registry.histogram(name));
}

代码示例来源:origin: kite-sdk/kite

@Override
public Histogram newMetric() {
 return new Histogram(new SlidingWindowReservoir(size));
}
@Override

代码示例来源: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: io.vertx/vertx-dropwizard-metrics

protected Histogram histogram(String... names) {
 try {
  return registry.histogram(nameOf(names));
 } catch (Exception e) {
  return new Histogram(new ExponentiallyDecayingReservoir());
 }
}

代码示例来源:origin: Baqend/Orestes-Bloomfilter

public RedisBloomFilterThroughput(String name) {
  testName = name;
  System.err.println("-------------- " + name + " --------------");
  this.readHistogram = new Histogram(new ExponentiallyDecayingReservoir());
  this.writeHistogram = new Histogram(new ExponentiallyDecayingReservoir());
}

相关文章