本文整理汇总了Java中com.codahale.metrics.ExponentiallyDecayingReservoir类的典型用法代码示例。如果您正苦于以下问题:Java ExponentiallyDecayingReservoir类的具体用法?Java ExponentiallyDecayingReservoir怎么用?Java ExponentiallyDecayingReservoir使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExponentiallyDecayingReservoir类属于com.codahale.metrics包,在下文中一共展示了ExponentiallyDecayingReservoir类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: KafkaUDPConsumer
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
public KafkaUDPConsumer(
Stage.Context context,
UDPConfigBean udpConfigBean,
KafkaTargetConfig kafkaTargetConfig,
BlockingQueue<Exception> errorQueue
) {
this.udpConfigBean = udpConfigBean;
this.kafkaTargetConfig = kafkaTargetConfig;
this.errorQueue = errorQueue;
acceptedPackagesMeter = context.createMeter("acceptedPackages");
discardedPackagesMeter = context.createMeter("discardedPackages");
errorPackagesMeter = context.createMeter("errorPackages");
udpTimer = context.createTimer("udp");
kafkaTimer = context.createTimer("kafka");
kafkaMessagesMeter = context.createMeter("kafkaMessages");
// context does not have a createHistogram(), TODO open JIRA for that
concurrencyHistogram = new Histogram(new ExponentiallyDecayingReservoir());
context
.getMetrics()
.register("custom." + context.getPipelineInfo().get(0).getInstanceName() + ".concurrentPackages.histogram",
concurrencyHistogram);
}
示例2: init
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
@Override
public List<Stage.ConfigIssue> init(Stage.Context context) {
List<Stage.ConfigIssue> issues = new ArrayList<>();
kafkaTimer = context.createTimer("kafka");
kafkaMessagesMeter = context.createMeter("kafkaMessages");
//TODO: change to use API-66 when API-66 is done.
concurrencyHistogram = new Histogram(new ExponentiallyDecayingReservoir());
context
.getMetrics()
.register("custom." + context.getPipelineInfo().get(0).getInstanceName() + ".concurrentRequests.histogram",
concurrencyHistogram);
try {
kafkaProducerPool = createKafkaProducerPool();
} catch (Exception ex) {
}
return issues;
}
示例3: run
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
@Override
public void run(
SourcePipe originPipe,
List<PipeRunner> pipes,
BadRecordsHandler badRecordsHandler,
List<StageOutput> stageOutputsToOverride,
StatsAggregationHandler statsAggregationHandler
) throws StageException, PipelineRuntimeException {
this.originPipe = originPipe;
this.pipes = pipes;
this.badRecordsHandler = badRecordsHandler;
this.statsAggregationHandler = statsAggregationHandler;
this.runnerPool = new RunnerPool<>(pipes, new RuntimeStats(), new Histogram(new ExponentiallyDecayingReservoir()));
stagesToSkip = new HashMap<>();
for (StageOutput stageOutput : stageOutputsToOverride) {
stagesToSkip.put(stageOutput.getInstanceName(), stageOutput);
}
if (originPipe.getStage().getStage() instanceof PushSource) {
runPushSource();
} else {
runPollSource();
}
}
示例4: create
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T create(final Class<T> type) {
if (type.equals(Meter.class)) {
return (T) new Meter();
}
if (type.equals(Counter.class)) {
return (T) new Counter();
}
if (type.equals(Histogram.class)) {
return (T) new Histogram(new ExponentiallyDecayingReservoir());
}
return null;
}
示例5: testFromHistogram
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
@Test
public void testFromHistogram() {
final Set<String> fieldKeys = ImmutableSet.of(
"count",
"min",
"max",
"mean",
"std-dev",
"50-percentile",
"75-percentile",
"95-percentile",
"99-percentile",
"999-percentile",
"run-count"
);
final DropwizardMeasurementParser parser = mock(DropwizardMeasurementParser.class);
final DropwizardTransformer transformer = transformerWithParser(parser, true);
when(parser.parse("some.metric.name")).thenReturn(
DropwizardMeasurement.create("Measurement", MEASUREMENT_TAGS, Optional.empty())
);
final Histogram histogram = new Histogram(new ExponentiallyDecayingReservoir());
histogram.update(15L);
histogram.update(70L);
histogram.update(100L);
final InfluxDbMeasurement measurement = transformer.fromHistogram("some.metric.name", histogram, 90210L);
assertEquals("should parse name from full metric key", "Measurement", measurement.name());
assertEquals("should add global and measurement tags", ALL_TAGS, measurement.tags());
assertEquals("should timestamp measurement", 90210L, measurement.timestamp());
assertEquals("should add all histogram fields", fieldKeys, measurement.fields().keySet());
}
示例6: CompositeForwardingHistogram
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
public CompositeForwardingHistogram(Histogram mainDelegate, MetricProvider<Histogram> supplementaryMetricProvider) {
super(new ExponentiallyDecayingReservoir());
Preconditions.checkNotNull(mainDelegate);
Preconditions.checkNotNull(supplementaryMetricProvider);
this.mainDelegate = mainDelegate;
this.supplementaryMetricProvider = supplementaryMetricProvider;
}
示例7: ForwardingReadOnlyHistogram
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
public ForwardingReadOnlyHistogram(final Histogram delegate) {
super(new ExponentiallyDecayingReservoir());
Preconditions.checkNotNull(delegate);
this.metricProvider = new MetricProvider<Histogram>() {
@Override
public Histogram get() {
return delegate;
}
};
}
示例8: testCreateTimer
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
@Test
public void testCreateTimer() throws Exception {
final ExponentiallyDecayingTimingStrategy strategy = new ExponentiallyDecayingTimingStrategy();
final Timer timer = strategy.createTimer(new MapConfig());
ExponentiallyDecayingReservoir reservoir = reservoir(timer);
assertNotNull(reservoir);
assertEquals("decay", strategy.name());
}
示例9: ContextAwareHistogram
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
ContextAwareHistogram(MetricContext context, String name) {
super(new ExponentiallyDecayingReservoir());
this.name = name;
this.context = context;
this.tagged = new Tagged();
Optional<MetricContext> parentContext = context.getParent();
if (parentContext.isPresent()) {
this.parentHistogram = Optional.fromNullable(parentContext.get().contextAwareHistogram(name));
} else {
this.parentHistogram = Optional.absent();
}
}
示例10: getReservoir
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
/**
* Get reservoir implementation based on the reservoir type
*
* @return The {@link Reservoir} implementation
*/
private Reservoir getReservoir() {
// The Reservoir implementation is selected using a switch statement.
// The ReservoirType enum is a part of YAML configuration
// and foreign imports are not supported by Carbon Configuration Maven Plugin.
// Therefore, the Reservoir class cannot be imported and the Reservoir
// creation logic cannot be written inside ReservoirType enum.
switch (reservoirType) {
case EXPONENTIALLY_DECAYING:
return new ExponentiallyDecayingReservoir();
case UNIFORM:
return new UniformReservoir(reservoirParametersConfig.getSize());
case SLIDING_WINDOW:
return new SlidingWindowReservoir(reservoirParametersConfig.getSize());
case SLIDING_TIME_WINDOW:
return new SlidingTimeWindowReservoir(reservoirParametersConfig.getWindow(),
reservoirParametersConfig.getWindowUnit());
case HDR_HISTOGRAM:
Recorder recorder = new Recorder(reservoirParametersConfig.getNumberOfSignificantValueDigits());
if (reservoirParametersConfig.isResetOnSnapshot()) {
return new HdrHistogramResetOnSnapshotReservoir(recorder);
} else {
return new HdrHistogramReservoir(recorder);
}
default:
throw new RuntimeException("Invalid Reservoir Type");
}
}
示例11: SamzaHistogram
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
public SamzaHistogram(MetricsRegistry registry, String group, String name, List<Double> percentiles) {
this.histogram = new Histogram(new ExponentiallyDecayingReservoir());
this.percentiles = percentiles;
this.gauges = this.percentiles.stream()
.filter(x -> x > 0 && x <= 100)
.collect(
Collectors.toMap(Function.identity(), x -> registry.newGauge(group, name + "_" + String.valueOf(0), 0D)));
}
示例12: SamzaHistogram
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
SamzaHistogram(MetricsRegistry registry, String group, String name, List<Double> percentiles) {
this.registry = registry;
this.histogram = new Histogram(new ExponentiallyDecayingReservoir());
this.percentiles = percentiles;
this.gauges = percentiles.stream()
.filter(x -> x > 0 && x <= 100)
.collect(
Collectors.toMap(Function.identity(), x -> this.registry.newGauge(group, name + "_" + String.valueOf(0), 0D)));
}
示例13: createHistogram5Min
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
public static Histogram createHistogram5Min(MetricRegistry metrics, String name, final String pipelineName, final String pipelineRev) {
return create(
metrics,
new Histogram(new ExponentiallyDecayingReservoir()),
metricName(name, HISTOGRAM_M5_SUFFIX),
pipelineName,
pipelineRev
);
}
示例14: createRunnerPool
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
@Before
public void createRunnerPool() {
this.runnerPool = new RunnerPool<>(
ImmutableList.of("a", "b"),
new RuntimeStats(),
new Histogram(new ExponentiallyDecayingReservoir())
);
}
示例15: receiveTiming
import com.codahale.metrics.ExponentiallyDecayingReservoir; //导入依赖的package包/类
public void receiveTiming(InetAddress host, long latency) // this is cheap
{
ExponentiallyDecayingReservoir sample = samples.get(host);
if (sample == null)
{
ExponentiallyDecayingReservoir maybeNewSample = new ExponentiallyDecayingReservoir(WINDOW_SIZE, ALPHA);
sample = samples.putIfAbsent(host, maybeNewSample);
if (sample == null)
sample = maybeNewSample;
}
sample.update(latency);
}