コード例 #1
0
ファイル: Meter.cs プロジェクト: brumschlag/nohros-must
        /// <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
ファイル: Meter.cs プロジェクト: joethinh/nohros-must
    /// <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_
        });
    }
コード例 #3
0
ファイル: ManualMeter.cs プロジェクト: joethinh/nohros-must
 /// <summary>
 /// Initializes a new instance of the <see cref=" Meter"/> class by using
 /// the specified meter name, rate unit and clock.
 /// </summary>
 /// <param name="start_time">
 /// The starting point.
 /// </param>
 /// <param name="rate_unit">
 /// The rate unit of the new meter.
 /// </param>
 public ManualMeter(TimeUnit rate_unit, long start_time) {
   count_ = 0;
   rate_unit_ = rate_unit;
   start_time_ = start_time;
   last_tick_ = start_time_;
   ewma_1_rate_ = ExponentialWeightedMovingAverages.OneMinute();
   ewma_5_rate_ = ExponentialWeightedMovingAverages.FiveMinute();
   ewma_15_rate_ = ExponentialWeightedMovingAverages.FifteenMinute();
   ignore_old_events_ = false;
 }
コード例 #4
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="start_time">
 /// The starting point.
 /// </param>
 /// <param name="rate_unit">
 /// The rate unit of the new meter.
 /// </param>
 public ManualMeter(TimeUnit rate_unit, long start_time)
 {
     count_             = 0;
     rate_unit_         = rate_unit;
     start_time_        = start_time;
     last_tick_         = start_time_;
     ewma_1_rate_       = ExponentialWeightedMovingAverages.OneMinute();
     ewma_5_rate_       = ExponentialWeightedMovingAverages.FiveMinute();
     ewma_15_rate_      = ExponentialWeightedMovingAverages.FifteenMinute();
     ignore_old_events_ = false;
 }