Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Builder"/> class by
 /// copying the configuration from the given <paramref name="config"/>.
 /// </summary>
 /// <param name="config"></param>
 public Builder(SnapshotConfig config) {
   Percentiles = config.Percentiles;
   ComputeCount = config.ComputeCount;
   ComputeMax = config.ComputeMax;
   ComputeMean = config.ComputeMean;
   ComputeMedian = config.ComputeMedian;
   ComputeMin = config.ComputeMin;
   ComputeStdDev = config.ComputeStdDev;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Builder"/> class by
 /// copying the configuration from the given <paramref name="config"/>.
 /// </summary>
 /// <param name="config"></param>
 public Builder(SnapshotConfig config)
 {
     Percentiles   = config.Percentiles;
     ComputeCount  = config.ComputeCount;
     ComputeMax    = config.ComputeMax;
     ComputeMean   = config.ComputeMean;
     ComputeMedian = config.ComputeMedian;
     ComputeMin    = config.ComputeMin;
     ComputeStdDev = config.ComputeStdDev;
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Histogram"/> by using the
        /// given <see cref="IResevoir"/>.
        /// </summary>
        /// <param name="config">
        /// A <see cref="MetricConfig"/> containing the configuration settings
        /// for the metric.
        /// </param>
        /// <param name="stats">
        /// A <see cref="SnapshotConfig"/> that defines the statistics that should
        /// be computed.
        /// </param>
        /// <param name="resevoir">
        /// A <see cref="IResevoir"/> that can be used to store the computed
        /// values.
        /// </param>
        /// <param name="context">
        /// A <see cref="MetricContext"/> that contains the shared
        /// <see cref="Mailbox{T}"/> and <see cref="Clock"/>.
        /// </param>
        public Histogram(MetricConfig config, SnapshotConfig stats,
                         IResevoir resevoir, MetricContext context)
            : base(config, context)
        {
            resevoir_ = resevoir;

            gauges_ = new List <CallableGaugeWrapper>();

            if (stats.ComputeCount)
            {
                gauges_.Add(CountGauge(config));
            }

            if (stats.ComputeMax)
            {
                gauges_.Add(MaxGauge(config));
            }

            if (stats.ComputeMean)
            {
                gauges_.Add(MeanGauge(config));
            }

            if (stats.ComputeMedian)
            {
                gauges_.Add(MedianGauge(config));
            }

            if (stats.ComputeMin)
            {
                gauges_.Add(MinGauge(config));
            }

            if (stats.ComputeStdDev)
            {
                gauges_.Add(StdDevGauge(config));
            }

            foreach (var percentile in stats.Percentiles)
            {
                gauges_.Add(PercentileGauge(config, percentile));
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Histogram"/> by using the
 /// given <see cref="IResevoir"/>.
 /// </summary>
 /// <param name="config">
 /// A <see cref="MetricConfig"/> containing the configuration settings
 /// for the metric.
 /// </param>
 /// <param name="stats">
 /// A <see cref="SnapshotConfig"/> that defines the statistics that should
 /// be computed.
 /// </param>
 /// <param name="resevoir">
 /// A <see cref="IResevoir"/> that can be used to store the computed
 /// values.
 /// </param>
 public Histogram(MetricConfig config, SnapshotConfig stats,
                  IResevoir resevoir)
     : this(config, stats, resevoir, MetricContext.ForCurrentProcess)
 {
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Histogram"/> that uses
 /// the <see cref="ExponentiallyDecayingResevoir"/> as resevoir.
 /// </summary>
 /// <param name="config">
 /// A <see cref="MetricConfig"/> containing the configuration settings
 /// for the metric.
 /// </param>
 /// <param name="stats">
 /// A <see cref="SnapshotConfig"/> that defines the statistics that should
 /// be computed.
 /// </param>
 public Histogram(MetricConfig config, SnapshotConfig stats)
     : this(config, stats, new ExponentiallyDecayingResevoir(),
            MetricContext.ForCurrentProcess)
 {
 }
Esempio n. 6
0
 public Builder WithSnapshotConfig(SnapshotConfig config)
 {
     SnapshotConfig = config;
     return(this);
 }
Esempio n. 7
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Histogram"/> by using the
    /// given <see cref="IResevoir"/>.
    /// </summary>
    /// <param name="config">
    /// A <see cref="MetricConfig"/> containing the configuration settings
    /// for the metric.
    /// </param>
    /// <param name="stats">
    /// A <see cref="SnapshotConfig"/> that defines the statistics that should
    /// be computed.
    /// </param>
    /// <param name="resevoir">
    /// A <see cref="IResevoir"/> that can be used to store the computed
    /// values.
    /// </param>
    /// <param name="context">
    /// A <see cref="MetricContext"/> that contains the shared
    /// <see cref="Mailbox{T}"/> and <see cref="Clock"/>.
    /// </param>
    public Histogram(MetricConfig config, SnapshotConfig stats,
      IResevoir resevoir, MetricContext context)
      : base(config, context) {
      resevoir_ = resevoir;

      gauges_ = new List<CallableGaugeWrapper>();

      if (stats.ComputeCount) {
        gauges_.Add(CountGauge(config));
      }

      if (stats.ComputeMax) {
        gauges_.Add(MaxGauge(config));
      }

      if (stats.ComputeMean) {
        gauges_.Add(MeanGauge(config));
      }

      if (stats.ComputeMedian) {
        gauges_.Add(MedianGauge(config));
      }

      if (stats.ComputeMin) {
        gauges_.Add(MinGauge(config));
      }

      if (stats.ComputeStdDev) {
        gauges_.Add(StdDevGauge(config));
      }

      foreach (var percentile in stats.Percentiles) {
        gauges_.Add(PercentileGauge(config, percentile));
      }
    }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Histogram"/> by using the
 /// given <see cref="IResevoir"/>.
 /// </summary>
 /// <param name="config">
 /// A <see cref="MetricConfig"/> containing the configuration settings
 /// for the metric.
 /// </param>
 /// <param name="stats">
 /// A <see cref="SnapshotConfig"/> that defines the statistics that should
 /// be computed.
 /// </param>
 /// <param name="resevoir">
 /// A <see cref="IResevoir"/> that can be used to store the computed
 /// values.
 /// </param>
 public Histogram(MetricConfig config, SnapshotConfig stats,
   IResevoir resevoir)
   : this(config, stats, resevoir, MetricContext.ForCurrentProcess) {
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Histogram"/> that uses
 /// the <see cref="ExponentiallyDecayingResevoir"/> as resevoir.
 /// </summary>
 /// <param name="config">
 /// A <see cref="MetricConfig"/> containing the configuration settings
 /// for the metric.
 /// </param>
 /// <param name="stats">
 /// A <see cref="SnapshotConfig"/> that defines the statistics that should
 /// be computed.
 /// </param>
 public Histogram(MetricConfig config, SnapshotConfig stats)
   : this(config, stats, new ExponentiallyDecayingResevoir(),
     MetricContext.ForCurrentProcess) {
 }