本文整理汇总了Java中io.micrometer.core.instrument.histogram.HistogramConfig类的典型用法代码示例。如果您正苦于以下问题:Java HistogramConfig类的具体用法?Java HistogramConfig怎么用?Java HistogramConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HistogramConfig类属于io.micrometer.core.instrument.histogram包,在下文中一共展示了HistogramConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newTimer
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected Timer newTimer(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetector) {
DropwizardTimer timer = new DropwizardTimer(id, registry.timer(hierarchicalName(id)), clock, histogramConfig, pauseDetector);
for (double percentile : histogramConfig.getPercentiles()) {
String formattedPercentile = DoubleFormat.toString(percentile * 100) + "percentile";
gauge(id.getName(), Tags.concat(getConventionTags(id), "percentile", formattedPercentile),
timer, t -> t.percentile(percentile, getBaseTimeUnit()));
}
if (histogramConfig.isPublishingHistogram()) {
for (Long bucket : histogramConfig.getHistogramBuckets(false)) {
more().counter(getConventionName(id), Tags.concat(getConventionTags(id), "bucket", Long.toString(bucket)),
timer, t -> t.histogramCountAtValue(bucket));
}
}
return timer;
}
示例2: newDistributionSummary
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected DistributionSummary newDistributionSummary(Meter.Id id, HistogramConfig histogramConfig) {
DropwizardDistributionSummary summary = new DropwizardDistributionSummary(id, clock, registry.histogram(hierarchicalName(id)), histogramConfig);
for (double percentile : histogramConfig.getPercentiles()) {
String formattedPercentile = DoubleFormat.toString(percentile * 100) + "percentile";
gauge(id.getName(), Tags.concat(getConventionTags(id), "percentile", formattedPercentile),
summary, s -> summary.percentile(percentile));
}
if (histogramConfig.isPublishingHistogram()) {
for (Long bucket : histogramConfig.getHistogramBuckets(false)) {
more().counter(getConventionName(id), Tags.concat(getConventionTags(id), "bucket", Long.toString(bucket)),
summary, s -> s.histogramCountAtValue(bucket));
}
}
return summary;
}
示例3: getOrCreateMeter
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
private Meter getOrCreateMeter(HistogramConfig config, BiFunction<Id, HistogramConfig, Meter> builder, Id mappedId) {
Meter m = meterMap.get(mappedId);
if (m == null) {
synchronized (meterMapLock) {
m = meterMap.get(mappedId);
if (m == null) {
m = builder.apply(mappedId, config);
register(mappedId, m);
for (Consumer<Meter> onAdd : meterAddedListeners) {
onAdd.accept(m);
}
}
}
}
return m;
}
示例4: newDistributionSummary
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected io.micrometer.core.instrument.DistributionSummary newDistributionSummary(Meter.Id id, HistogramConfig histogramConfig) {
com.netflix.spectator.api.DistributionSummary internalSummary = registry.distributionSummary(spectatorId(id));
if (histogramConfig.isPercentileHistogram()) {
// This doesn't report the normal count/totalTime/max stats, so we treat it as additive
PercentileDistributionSummary.get(registry, spectatorId(id));
}
SpectatorDistributionSummary summary = new SpectatorDistributionSummary(id, internalSummary, clock, histogramConfig);
for (long sla : histogramConfig.getSlaBoundaries()) {
gauge(id.getName(), Tags.concat(getConventionTags(id), "sla", Long.toString(sla)), sla, summary::histogramCountAtValue);
}
for (double percentile : histogramConfig.getPercentiles()) {
gauge(id.getName(), Tags.concat(getConventionTags(id), "percentile", percentileFormat.format(percentile)),
summary, s -> s.percentile(percentile));
}
return summary;
}
示例5: PrometheusDistributionSummary
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
PrometheusDistributionSummary(Id id, Clock clock, HistogramConfig histogramConfig) {
super(id, clock, histogramConfig);
this.max = new TimeDecayingMax(clock, histogramConfig);
this.percentilesHistogram = new TimeWindowHistogram(clock,
HistogramConfig.builder()
.histogramExpiry(Duration.ofDays(1825)) // effectively never roll over
.histogramBufferLength(1)
.build()
.merge(histogramConfig));
}
示例6: distributionSummariesRecordMax
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Issue("#61")
@Test
void distributionSummariesRecordMax() {
DistributionSummary summary = registry.summary("my.summary");
summary.record(10);
summary.record(1);
assertThat(summary.max()).isEqualTo(10);
assertThat(registry.scrape()).contains("my_summary_max 10.0");
clock(registry).add(PrometheusConfig.DEFAULT.step().toMillis() * HistogramConfig.DEFAULT.getHistogramBufferLength(),
TimeUnit.MILLISECONDS);
assertThat(summary.max()).isEqualTo(0);
assertThat(registry.scrape()).contains("my_summary_max 0.0");
}
示例7: defaultHistogramConfig
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected HistogramConfig defaultHistogramConfig() {
return HistogramConfig.builder()
.histogramExpiry(dropwizardConfig.step())
.build()
.merge(HistogramConfig.DEFAULT);
}
示例8: CumulativeTimer
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
/**
* Create a new instance.
*/
public CumulativeTimer(Id id, Clock clock, HistogramConfig histogramConfig, PauseDetector pauseDetector, TimeUnit baseTimeUnit) {
super(id, clock, histogramConfig, pauseDetector, baseTimeUnit);
this.count = new AtomicLong();
this.total = new AtomicLong();
this.max = new TimeDecayingMax(clock, histogramConfig);
}
示例9: StepTimer
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
/**
* Create a new instance.
*/
public StepTimer(Id id, Clock clock, HistogramConfig histogramConfig, PauseDetector pauseDetector, TimeUnit baseTimeUnit) {
super(id, clock, histogramConfig, pauseDetector, baseTimeUnit);
this.count = new StepLong(clock, histogramConfig.getHistogramExpiry().toMillis());
this.total = new StepLong(clock, histogramConfig.getHistogramExpiry().toMillis());
this.max = new TimeDecayingMax(clock, histogramConfig);
}
示例10: defaultHistogramConfig
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected HistogramConfig defaultHistogramConfig() {
return HistogramConfig.builder()
.histogramExpiry(config.step())
.build()
.merge(HistogramConfig.DEFAULT);
}
示例11: AbstractTimer
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
protected AbstractTimer(Id id, Clock clock, HistogramConfig histogramConfig, PauseDetector pauseDetector, TimeUnit baseTimeUnit) {
super(id);
this.clock = clock;
this.histogramConfig = histogramConfig;
this.histogram = new TimeWindowLatencyHistogram(clock, histogramConfig, pauseDetector);
this.baseTimeUnit = baseTimeUnit;
}
示例12: newDistributionSummary
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected DistributionSummary newDistributionSummary(Meter.Id id, HistogramConfig histogramConfig) {
HistogramConfig merged = histogramConfig.merge(HistogramConfig.builder()
.histogramExpiry(config.step())
.build());
DistributionSummary summary;
switch (config.mode()) {
case Cumulative:
summary = new CumulativeDistributionSummary(id, clock, merged);
break;
case Step:
default:
summary = new StepDistributionSummary(id, clock, merged);
break;
}
for (double percentile : histogramConfig.getPercentiles()) {
gauge(id.getName(), Tags.concat(getConventionTags(id), "percentile", percentileFormat.format(percentile)),
summary, s -> summary.percentile(percentile));
}
if(histogramConfig.isPublishingHistogram()) {
for (Long bucket : histogramConfig.getHistogramBuckets(false)) {
more().counter(getConventionName(id), Tags.concat(getConventionTags(id), "bucket", Long.toString(bucket)),
summary, s -> s.histogramCountAtValue(bucket));
}
}
return summary;
}
示例13: newTimer
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected Timer newTimer(Meter.Id id, HistogramConfig histogramConfig, PauseDetector pauseDetector) {
HistogramConfig merged = histogramConfig.merge(HistogramConfig.builder()
.histogramExpiry(config.step())
.build());
Timer timer;
switch (config.mode()) {
case Cumulative:
timer = new CumulativeTimer(id, clock, merged, pauseDetector, getBaseTimeUnit());
break;
case Step:
default:
timer = new StepTimer(id, clock, merged, pauseDetector, getBaseTimeUnit());
break;
}
for (double percentile : histogramConfig.getPercentiles()) {
gauge(id.getName(), Tags.concat(getConventionTags(id), "percentile", percentileFormat.format(percentile)),
timer, t -> t.percentile(percentile, getBaseTimeUnit()));
}
if(histogramConfig.isPublishingHistogram()) {
for (Long bucket : histogramConfig.getHistogramBuckets(false)) {
more().counter(getConventionName(id), Tags.concat(getConventionTags(id), "bucket",
percentileFormat.format(TimeUtils.nanosToUnit(bucket, getBaseTimeUnit()))),
timer, t -> t.histogramCountAtValue(bucket));
}
}
return timer;
}
示例14: recordMax
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Test
default void recordMax(MeterRegistry registry) {
Timer timer = registry.timer("my.timer");
timer.record(10, TimeUnit.MILLISECONDS);
timer.record(1, TimeUnit.SECONDS);
clock(registry).add(step()); // for Atlas, which is step rather than ring-buffer based
assertThat(timer.max(TimeUnit.SECONDS)).isEqualTo(1);
assertThat(timer.max(TimeUnit.MILLISECONDS)).isEqualTo(1000);
clock(registry).add(Duration.ofMillis(step().toMillis() * HistogramConfig.DEFAULT.getHistogramBufferLength()));
assertThat(timer.max(TimeUnit.SECONDS)).isEqualTo(0);
}
示例15: SpectatorDistributionSummary
import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
SpectatorDistributionSummary(Id id,
com.netflix.spectator.api.DistributionSummary distributionSummary,
Clock clock,
HistogramConfig histogramConfig) {
super(id, clock, histogramConfig);
this.summary = distributionSummary;
}