public static HealthCountsStream GetInstance(IHystrixCommandKey commandKey, int numBuckets, int bucketSizeInMs) { var result = Streams.GetOrAddEx(commandKey.Name, (k) => { var newStream = new HealthCountsStream(commandKey, numBuckets, bucketSizeInMs, HystrixCommandMetrics.AppendEventToBucket); newStream.StartCachingStreamValuesIfUnstarted(); return(newStream); }); return(result); }
public static void RemoveByKey(IHystrixCommandKey key) { HealthCountsStream old = null; streams.TryRemove(key.Name, out old); }