当前位置: 首页>>代码示例>>Java>>正文


Java HistogramConfig类代码示例

本文整理汇总了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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:20,代码来源:DropwizardMeterRegistry.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:20,代码来源:DropwizardMeterRegistry.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:19,代码来源:MeterRegistry.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:23,代码来源:AtlasMeterRegistry.java

示例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));
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:11,代码来源:PrometheusDistributionSummary.java

示例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");
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:17,代码来源:PrometheusMeterRegistryTest.java

示例7: defaultHistogramConfig

import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected HistogramConfig defaultHistogramConfig() {
    return HistogramConfig.builder()
        .histogramExpiry(dropwizardConfig.step())
        .build()
        .merge(HistogramConfig.DEFAULT);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:DropwizardMeterRegistry.java

示例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);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:10,代码来源:CumulativeTimer.java

示例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);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:10,代码来源:StepTimer.java

示例10: defaultHistogramConfig

import io.micrometer.core.instrument.histogram.HistogramConfig; //导入依赖的package包/类
@Override
protected HistogramConfig defaultHistogramConfig() {
    return HistogramConfig.builder()
        .histogramExpiry(config.step())
        .build()
        .merge(HistogramConfig.DEFAULT);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:StepMeterRegistry.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:AbstractTimer.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:32,代码来源:SimpleMeterRegistry.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:33,代码来源:SimpleMeterRegistry.java

示例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);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:14,代码来源:TimerTest.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:SpectatorDistributionSummary.java


注:本文中的io.micrometer.core.instrument.histogram.HistogramConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。