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


Java ExponentiallyDecayingReservoir类代码示例

本文整理汇总了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);
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:25,代码来源:KafkaUDPConsumer.java

示例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;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:21,代码来源:KafkaFragmentWriter.java

示例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();
  }
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:26,代码来源:PreviewPipelineRunner.java

示例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;

}
 
开发者ID:javadelight,项目名称:delight-metrics,代码行数:20,代码来源:MetricsFactory.java

示例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());
}
 
开发者ID:kickstarter,项目名称:dropwizard-influxdb-reporter,代码行数:35,代码来源:DropwizardTransformerTest.java

示例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;
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:10,代码来源:CompositeForwardingHistogram.java

示例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;
        }
    };
}
 
开发者ID:centro,项目名称:monitoring-center,代码行数:12,代码来源:ForwardingReadOnlyHistogram.java

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

示例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();
  }
}
 
开发者ID:Hanmourang,项目名称:Gobblin,代码行数:15,代码来源:ContextAwareHistogram.java

示例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");

    }
}
 
开发者ID:wso2,项目名称:carbon-metrics,代码行数:34,代码来源:MetricManager.java

示例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)));
}
 
开发者ID:apache,项目名称:samza,代码行数:9,代码来源:SamzaHistogram.java

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

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

示例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())
  );
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:9,代码来源:TestRunnerPool.java

示例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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:13,代码来源:DynamicEndpointSnitch.java


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