private static void MeasureTime(IMetrics metrics, TimeSpan timeSpan)
        {
            var timer = new App.Metrics.Timer.TimerOptions
            {
                Name         = "ShortShaKeyGenerationTime",
                DurationUnit = TimeUnit.Milliseconds,
                RateUnit     = TimeUnit.Milliseconds
            };

            metrics?.Provider?.Timer.Instance(timer).Record((long)timeSpan.TotalMilliseconds, TimeUnit.Milliseconds);
        }
        public static void MeasureTime(IMetrics metrics, TimeSpan duration)
        {
            var timer = new App.Metrics.Timer.TimerOptions
            {
                Name         = "KeyArchiveSaveTime",
                DurationUnit = TimeUnit.Milliseconds,
                RateUnit     = TimeUnit.Milliseconds
            };

            metrics?.Provider?.Timer.Instance(timer).Record((long)duration.TotalMilliseconds, TimeUnit.Milliseconds);
        }
Exemple #3
0
        public static ITimer Timer(App.Metrics.IMetrics context, string name, Units unit, SamplingTypes samplingType, TimeUnits rateUnit, TimeUnits durationUnit, List <KeyValuePair <string, string> > tags = null)
        {
            var options = new App.Metrics.Timer.TimerOptions
            {
                MeasurementUnit = unit.GetUnit(),
                Name            = name,
                DurationUnit    = (App.Metrics.TimeUnit)durationUnit,
                RateUnit        = (App.Metrics.TimeUnit)rateUnit,
                Tags            = tags.GetTags()
            };

            return(new Timer(context.Provider.Timer.Instance(options)));
        }