public void Count(string counterName, long delta) { if (String.IsNullOrEmpty(counterName) || delta <= 0) { return; } metricsCache.IncrementCount(counterName, delta); }
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(); } }