A meter metric which measures mean throughput and one-, five-, and fifteen-minute exponentially-weighted moving average throughputs.
Inheritance: IMetric, IMetered, IDisposable
コード例 #1
0
        public PrefetchingBehavior(PrefetchingUser prefetchingUser, 
            WorkContext context, 
            BaseBatchSizeAutoTuner autoTuner, 
            string prefetchingUserDescription, 
            bool isDefault = false,
            Func<int> getPrefetchintBehavioursCount = null,
            Func<PrefetchingSummary> getPrefetcherSummary = null)
        {
            this.context = context;
            this.autoTuner = autoTuner;
            PrefetchingUser = prefetchingUser;
            this.userDescription = prefetchingUserDescription;
            this.IsDefault = isDefault;
            this.getPrefetchintBehavioursCount = getPrefetchintBehavioursCount ?? (() => 1);
            this.getPrefetcherSummary = getPrefetcherSummary ?? GetSummary;
            MemoryStatistics.RegisterLowMemoryHandler(this);
            LastTimeUsed = DateTime.MinValue;

            ingestMeter = context.MetricsCounters.DbMetrics.Meter("metrics",
                "ingest/sec", "In memory documents held by this prefetcher", TimeUnit.Seconds);
            returnedDocsMeter = context.MetricsCounters.DbMetrics.Meter("metrics",
                  "returned docs/sec", "Documents being served by this prefetcher", TimeUnit.Seconds);

            if (isDefault)
            {
                context.Database.TransactionalStorage.Batch(accessor =>
                {
                    recentEtag = accessor.Staleness.GetMostRecentDocumentEtag();
                });
            }
        }
コード例 #2
0
 public ManualTimerMetric(
  TimeUnit durationUnit, 
  TimeUnit rateUnit, 
  MeterMetric meter, 
  HistogramMetric histogram, 
  bool clear)
     : base(durationUnit, rateUnit, meter, histogram, clear)
 {
 }
コード例 #3
0
 public ManualTimerMetric(
     TimeUnit durationUnit,
     TimeUnit rateUnit,
     MeterMetric meter,
     HistogramMetric histogram,
     bool clear)
     : base(durationUnit, rateUnit, meter, histogram, clear)
 {
 }
コード例 #4
0
 protected TimerMetricBase(TimeUnit durationUnit, TimeUnit rateUnit, MeterMetric meter, HistogramMetric histogram, bool clear)
 {
     DurationUnit = durationUnit;
      RateUnit = rateUnit;
      _meter = meter;
      _histogram = histogram;
      if(clear)
      {
     Clear();
      }
 }
コード例 #5
0
 protected TimerMetricBase(TimeUnit durationUnit, TimeUnit rateUnit, MeterMetric meter, HistogramMetric histogram, bool clear)
 {
     DurationUnit = durationUnit;
     RateUnit     = rateUnit;
     _meter       = meter;
     _histogram   = histogram;
     if (clear)
     {
         Clear();
     }
 }
コード例 #6
0
        public static MeterMetric New(string eventType, TimeUnit rateUnit)
        {
            var meter = new MeterMetric(eventType, rateUnit);

            Task.Factory.StartNew(async() =>
            {
                while (!meter._token.IsCancellationRequested)
                {
                    await Task.Delay(Interval, meter._token.Token);
                    meter.Tick();
                }
            }, meter._token.Token);
            return(meter);
        }
コード例 #7
0
ファイル: MeterMetric.cs プロジェクト: modulexcite/graveyard
        public static MeterMetric New(string eventType, TimeUnit rateUnit)
        {
            var meter = new MeterMetric(eventType, rateUnit);

            Task.Factory.StartNew(() =>
            {
                while (!meter._token.IsCancellationRequested)
                {
                    Thread.Sleep(Interval);
                    meter.Tick();
                }
            }, meter._token.Token);

            return meter;
        }
コード例 #8
0
 private static MeterData CreateMeterData(MeterMetric metric)
 {
     return new MeterData
            {
                Count = metric.Count,
                FifteenMinuteRate = Math.Round(metric.FifteenMinuteRate, 3),
                FiveMinuteRate = Math.Round(metric.FiveMinuteRate, 3),
                MeanRate = Math.Round(metric.MeanRate, 3),
                OneMinuteRate = Math.Round(metric.OneMinuteRate, 3),
            };
 }
コード例 #9
0
        public static MeterMetric New(string eventType, TimeUnit rateUnit)
        {
            var meter = new MeterMetric(eventType, rateUnit);

            meter._tickThread = _factory.New(
                ()=>
                    {
                        new Timer(s => meter.Tick(), null, _interval, _interval);
                    }
                );

            meter._tickThread.Start();

            return meter;
        }
コード例 #10
0
 public TimerMetricBase(TimeUnit durationUnit, TimeUnit rateUnit)
     : this(durationUnit, rateUnit, MeterMetric.New("calls", rateUnit), new HistogramMetric(HistogramMetric.SampleType.Biased), true /* clear */)
 {
 }
コード例 #11
0
ファイル: MeterMetric.cs プロジェクト: ucdavis/metrics-net
        public static MeterMetric New(string eventType, TimeUnit rateUnit)
        {
            var meter = new MeterMetric(eventType, rateUnit);

            meter._token = Utils.StartCancellableTask(() =>
            {
                while (!meter._token.IsCancellationRequested)
                {
                    Thread.Sleep(Interval);
                    meter.Tick();
                }
            });

            return meter;
        }
コード例 #12
0
 private void LogMeter(IRequest request, MetricName metricName, MeterMetric metric, long timestamp)
 {
     request.AddCounter(new DatadogCounter(_nameFormatter.Format(metricName.Name, _path), metric.Count, timestamp, _globalTags));
 }