Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref=" Meter"/> class by using
        /// the specified meter name, rate unit and clock.
        /// </summary>
        /// <param name="config">
        /// A <see cref="MetricConfig"/> containing the configuration settings
        /// for the metric.
        /// </param>
        /// <param name="rate_unit">
        /// The time unit of the meter's rate.
        /// </param>
        /// <param name="context">
        /// A <see cref="MetricContext"/> that contains the shared
        /// <see cref="Mailbox{T}"/> and <see cref="Clock"/>.
        /// </param>
        internal Meter(MetricConfig config, TimeUnit rate_unit,
                       MetricContext context) : base(config, context)
        {
            const string kStatistic = "statistic";

            mean_rate_ = new MeanRate(
                config.WithAdditionalTag(new Tag(kStatistic, "mean_rate")), rate_unit,
                context);

            ewma_1_rate_ = ExponentialWeightedMovingAverage
                           .ForOneMinute(
                config.WithAdditionalTag(new Tag(kStatistic, "ewma_m1_rate")),
                rate_unit, context);

            ewma_5_rate_ = ExponentialWeightedMovingAverage
                           .ForFiveMinutes(
                config.WithAdditionalTag(new Tag(kStatistic, "ewma_m5_rate")),
                rate_unit, context);

            ewma_15_rate_ = ExponentialWeightedMovingAverage
                            .ForFifteenMinutes(
                config.WithAdditionalTag(new Tag(kStatistic, "ewma_m15_rate")),
                rate_unit, context);

            metrics_ = new ReadOnlyCollection <IMetric>(
                new IMetric[] {
                mean_rate_, ewma_1_rate_, ewma_5_rate_, ewma_15_rate_
            });
        }
Пример #2
0
    /// <summary>
    /// Initializes a new instance of the <see cref=" Meter"/> class by using
    /// the specified meter name, rate unit and clock.
    /// </summary>
    /// <param name="config">
    /// A <see cref="MetricConfig"/> containing the configuration settings
    /// for the metric.
    /// </param>
    /// <param name="rate_unit">
    /// The time unit of the meter's rate.
    /// </param>
    /// <param name="context">
    /// A <see cref="MetricContext"/> that contains the shared
    /// <see cref="Mailbox{T}"/> and <see cref="Clock"/>.
    /// </param>
    internal Meter(MetricConfig config, TimeUnit rate_unit,
      MetricContext context) : base(config, context) {
      const string kStatistic = "statistic";

      mean_rate_ = new MeanRate(
        config.WithAdditionalTag(new Tag(kStatistic, "mean_rate")), rate_unit,
        context);

      ewma_1_rate_ = ExponentialWeightedMovingAverage
        .ForOneMinute(
          config.WithAdditionalTag(new Tag(kStatistic, "ewma_m1_rate")),
          rate_unit, context);

      ewma_5_rate_ = ExponentialWeightedMovingAverage
        .ForFiveMinutes(
          config.WithAdditionalTag(new Tag(kStatistic, "ewma_m5_rate")),
          rate_unit, context);

      ewma_15_rate_ = ExponentialWeightedMovingAverage
        .ForFifteenMinutes(
          config.WithAdditionalTag(new Tag(kStatistic, "ewma_m15_rate")),
          rate_unit, context);

      metrics_ = new ReadOnlyCollection<IMetric>(
        new IMetric[] {
          mean_rate_, ewma_1_rate_, ewma_5_rate_, ewma_15_rate_
        });
    }