/// <summary> /// Creates a new timer by using the specified name and resevoir and the /// default values for time unit and snapshot config. /// </summary> /// <param name="name"> /// The name of the timer /// </param> /// <param name="reservoir"> /// </param> /// <returns> /// A <see cref="StatsTimer"/> whose name is <paramref name="name"/> and uses /// the specified resevoir and default time unit and snapshot config. /// </returns> public static StatsTimer Create(string name, IResevoir reservoir) { return (new Builder(new MetricConfig(name)) .WithResevoir(reservoir) .Build()); }
/// <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)); } }
/// <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) { }
public Builder WithResevoir(IResevoir resevoir) { Resevoir = resevoir; return(this); }
/// <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)); } }