public void AddBucket(Bucket lastBucket) { foreach (HystrixRollingNumberEvent type in HystrixRollingNumberEventHelper.Values) { if (HystrixRollingNumberEventHelper.IsCounter(type)) { GetAdder(type).Add(lastBucket.GetAdder(type).Sum()); } if (HystrixRollingNumberEventHelper.IsMaxUpdater(type)) { GetMaxUpdater(type).Update(lastBucket.GetMaxUpdater(type).Max); } } }
/// <summary> /// Updates the cumulative values by the values of a <see cref="Bucket"/>. /// </summary> /// <param name="lastBucket">The bucket to update with.</param> public void AddBucket(Bucket lastBucket) { foreach (HystrixRollingNumberEvent type in HystrixRollingNumberEventExtensions.Values) { if (type.IsCounter()) { this.GetAdder(type).Add(lastBucket.GetAdder(type).Sum()); } if (type.IsMaxUpdater()) { this.GetMaxUpdater(type).Update(lastBucket.GetMaxUpdater(type).Max()); } } }
internal long GetValueOfLatestBucket(RollingNumberEvent ev) { Bucket lastBucket = GetCurrentBucket(); if (lastBucket == null) { return(0); } // we have bucket data so we'll return the lastBucket if ((int)ev > (int)RollingNumberEvent.MAX_COUNTER) { return(lastBucket.GetMaxUpdater(ev)); } else { return(lastBucket.GetAdder(ev)); } }
/// <summary> /// Updates the cumulative values by the values of a <see cref="Bucket"/>. /// </summary> /// <param name="lastBucket">The bucket to update with.</param> public void AddBucket(Bucket lastBucket) { foreach (RollingNumberEvent type in RollingNumberEventExtensions.Values) { if (type.IsCounter()) { this.GetAdder(type).Add(lastBucket.GetAdder(type).Sum()); } if (type.IsMaxUpdater()) { this.GetMaxUpdater(type).Update(lastBucket.GetMaxUpdater(type).Max()); } } }