コード例 #1
0
        public static IDisposable Gauge(
            this IMetricScope scope,
            TimeSpan period,
            string name,
            Func <double> getValue)
        {
            var clock = MetricClocks.Get(period);

            return(new DisposableMetric(
                       clock,
                       timestamp =>
            {
                var value = getValue();
                SendMetricToScope(scope, name, timestamp, value);
            }));
        }
コード例 #2
0
        public static ICounter Counter(
            this IMetricScope scope,
            TimeSpan period,
            string name)
        {
            var counter = new Counter();
            var clock   = MetricClocks.Get(period);

            return(new DisposableCounter(
                       counter,
                       clock,
                       timestamp =>
            {
                var value = counter.Reset();
                SendMetricToScope(scope, name, timestamp, value);
            }));
        }