示例#1
0
        public void Count(string counterName, long delta)
        {
            if (String.IsNullOrEmpty(counterName) || delta <= 0)
            {
                return;
            }

            metricsCache.IncrementCount(counterName, delta);
        }
示例#2
0
        public void Count(string counterName, long delta)
        {
            if (string.IsNullOrEmpty(counterName) || delta <= 0)
            {
                return;
            }

            Counter counter = metricsCache.IncrementCount(counterName, delta);

            var oldLastCall = countLastCall;

            countLastCall = DateTime.UtcNow;
            if (counter.GetCount() >= maxCountCalls || ((countLastCall - oldLastCall).TotalMilliseconds > maxTimeBetweenCalls))
            {
                SendCountMetrics();
            }
        }