Esempio n. 1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultBucketTimerMetric" /> class.
 /// </summary>
 /// <param name="histogram">The histogram implementation to use.</param>
 /// <param name="meter">The meter implementation to use to genreate the rate of events over time.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 /// <param name="timeUnit">The time unit for this timer.</param>
 public DefaultBucketTimerMetric(IBucketHistogramMetric histogram, IMeterMetric meter, IClock clock, TimeUnit timeUnit)
 {
     _clock     = clock;
     _timeUnit  = timeUnit;
     _meter     = meter;
     _histogram = histogram;
 }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultBucketTimerMetric" /> class.
 /// </summary>
 /// <param name="histogram">The histogram implementation to use.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 /// <param name="timeUnit">The time unit for this timer.</param>
 public DefaultBucketTimerMetric(IBucketHistogramMetric histogram, IClock clock, TimeUnit timeUnit)
 {
     _clock     = clock;
     _timeUnit  = timeUnit;
     _histogram = histogram;
     _meter     = new DefaultMeterMetric(clock);
 }
        /// <inheritdoc />
        public ITimerMetric Build(Lazy <IReservoir> reservoir, IMeterMetric meter, IClock clock)
        {
            if (reservoir == null)
            {
                reservoir = _defaultSamplingReservoirProvider.Instance();
            }

            return(new DefaultTimerMetric(reservoir, meter, clock));
        }
Esempio n. 4
0
        /// <inheritdoc />
        public ITimerMetric Build(Func <IReservoir> setupReservoir, IMeterMetric meter, IClock clock)
        {
            if (setupReservoir == null)
            {
                setupReservoir = _defaultSamplingReservoirProvider.Instance;
            }

            var reservoir = setupReservoir() ?? _defaultSamplingReservoirProvider.Instance();

            return(new DefaultTimerMetric(reservoir, meter, clock));
        }
Esempio n. 5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultTimerMetric" /> class.
 /// </summary>
 /// <param name="reservoir">The reservoir implementation to use for sampling values to generate the histogram.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 /// <param name="meterTickScheduler">The scheduler used to tick the associated meter.</param>
 internal DefaultTimerMetric(IReservoir reservoir, IClock clock, IMeterTickerScheduler meterTickScheduler)
 {
     _clock     = clock;
     _histogram = new DefaultHistogramMetric(reservoir);
     _meter     = new DefaultMeterMetric(clock, meterTickScheduler);
 }
Esempio n. 6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultTimerMetric" /> class.
 /// </summary>
 /// <param name="histogram">The histogram implementation to use.</param>
 /// <param name="meter">The meter implementation to use to genreate the rate of events over time.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 public DefaultTimerMetric(IHistogramMetric histogram, IMeterMetric meter, IClock clock)
 {
     _clock     = clock;
     _meter     = meter;
     _histogram = histogram;
 }
Esempio n. 7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultTimerMetric" /> class.
 /// </summary>
 /// <param name="reservoir">The reservoir to use for sampling within the histogram.</param>
 /// <param name="meter">The meter implementation to use to genreate the rate of events over time.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 public DefaultTimerMetric(IReservoir reservoir, IMeterMetric meter, IClock clock)
     : this(new DefaultHistogramMetric(reservoir), meter, clock)
 {
 }
Esempio n. 8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultTimerMetric" /> class.
 /// </summary>
 /// <param name="reservoir">The reservoir implementation to use for sampling values to generate the histogram.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 public DefaultTimerMetric(IReservoir reservoir, IClock clock)
 {
     _clock     = clock;
     _histogram = new DefaultHistogramMetric(reservoir);
     _meter     = new DefaultMeterMetric(clock);
 }
Esempio n. 9
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultTimerMetric" /> class.
 /// </summary>
 /// <param name="histogram">The histogram implementation to use.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 public DefaultTimerMetric(IHistogramMetric histogram, IClock clock)
 {
     _clock     = clock;
     _histogram = histogram;
     _meter     = new DefaultMeterMetric(clock);
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TimerMetric" /> class.
 /// </summary>
 /// <param name="samplingType">Type of the sampling to use to generate the resevoir of values.</param>
 /// <param name="sampleSize">The number of samples to keep in the sampling reservoir used by the histogram</param>
 /// <param name="alpha">
 ///     The alpha value, e.g 0.015 will heavily biases the reservoir to the past 5 mins of measurements. The higher the
 ///     value the more biased the reservoir will be towards newer values.
 /// </param>
 /// <param name="meter">The meter implementation to use to genreate the rate of events over time.</param>
 /// <param name="clock">The clock to use to measure processing duration.</param>
 public TimerMetric(SamplingType samplingType, int sampleSize, double alpha, IMeterMetric meter, IClock clock)
     : this(new HistogramMetric(samplingType, sampleSize, alpha), meter, clock)
 {
 }
 /// <inheritdoc />
 public IBucketTimerMetric Build(IEnumerable <double> buckets, IMeterMetric meter, IClock clock, TimeUnit timeUnit)
 {
     return(new DefaultBucketTimerMetric(new DefaultBucketHistogramMetric(buckets), meter, clock, timeUnit));
 }
 /// <inheritdoc />
 public IBucketTimerMetric Build(IBucketHistogramMetric histogram, IMeterMetric meter, IClock clock, TimeUnit timeUnit)
 {
     return(new DefaultBucketTimerMetric(histogram, meter, clock, timeUnit));
 }
Esempio n. 13
0
 /// <inheritdoc />
 public ITimerMetric Build(IHistogramMetric histogram, IMeterMetric meter, IClock clock)
 {
     return(new DefaultTimerMetric(histogram, meter, clock));
 }