Ejemplo n.º 1
0
        public static MeterMetric New(string eventType, TimeUnit rateUnit)
        {
            var meter = new MeterMetric(eventType, rateUnit);

            meter.Start();
            return(meter);
        }
Ejemplo n.º 2
0
 private TimerMetric(TimeUnit durationUnit, TimeUnit rateUnit, MeterMetric meter, HistogramMetric histogram,
                     bool clear)
 {
     DurationUnit = durationUnit;
     RateUnit     = rateUnit;
     _meter       = meter;
     _histogram   = histogram;
     if (clear)
     {
         Clear();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Creates a new meter metric and registers it under the given type and name
        /// </summary>
        /// <param name="owner">The type that owns the metric</param>
        /// <param name="name">The metric name</param>
        /// <param name="eventType">The plural name of the type of events the meter is measuring (e.g., <code>"requests"</code>)</param>
        /// <param name="rateUnit">The rate unit of the new meter</param>
        /// <returns></returns>
        public MeterMetric Meter(Type owner, string name, string eventType, TimeUnit rateUnit)
        {
            var metricName = new MetricName(owner, name);

            if (_store.TryGetValue(metricName, out var existingMetric))
            {
                return((MeterMetric)existingMetric);
            }

            var metric          = MeterMetric.New(eventType, rateUnit);
            var justAddedMetric = _store.GetOrAdd(metricName, metric);

            return(justAddedMetric == null ? metric : (MeterMetric)justAddedMetric);
        }
Ejemplo n.º 4
0
 public TimerMetric(TimeUnit durationUnit, TimeUnit rateUnit) : this(durationUnit, rateUnit,
                                                                     MeterMetric.New("updates", rateUnit), new HistogramMetric(SampleType.Biased), true)
 {
 }