Example #1
0
        public void Before()
        {
            context = HystrixRequestContext.InitializeContext();

            HystrixCommandMetrics.Reset();
            HystrixThreadPoolMetrics.Reset();
            HystrixCollapserMetrics.Reset();

            // clear collapsers
            RequestCollapserFactory.Reset();

            // clear circuit breakers
            HystrixCircuitBreakerFactory.Reset();
            HystrixPlugins.Reset();
            HystrixOptionsFactory.Reset();

            // clear up all streams
            CumulativeCollapserEventCounterStream.Reset();
            CumulativeCommandEventCounterStream.Reset();
            CumulativeThreadPoolEventCounterStream.Reset();
            RollingCollapserBatchSizeDistributionStream.Reset();
            RollingCollapserEventCounterStream.Reset();
            RollingCommandEventCounterStream.Reset();
            RollingCommandLatencyDistributionStream.Reset();
            RollingCommandMaxConcurrencyStream.Reset();
            RollingCommandUserLatencyDistributionStream.Reset();
            RollingThreadPoolEventCounterStream.Reset();
            RollingThreadPoolMaxConcurrencyStream.Reset();
        }
 public static void ShutdownThreads()
 {
     CumulativeCommandEventCounterStream.Reset();
     CumulativeThreadPoolEventCounterStream.Reset();
     RollingCommandEventCounterStream.Reset();
     RollingThreadPoolEventCounterStream.Reset();
     RollingCollapserEventCounterStream.Reset();
     RollingCollapserEventCounterStream.Reset();
     HealthCountsStream.Reset();
     RollingCollapserBatchSizeDistributionStream.Reset();
     RollingCommandLatencyDistributionStream.Reset();
     RollingCommandUserLatencyDistributionStream.Reset();
     RollingCommandMaxConcurrencyStream.Reset();
     RollingThreadPoolMaxConcurrencyStream.Reset();
 }
        HystrixCommandMetrics(IHystrixCommandKey key, IHystrixCommandGroupKey commandGroup, IHystrixThreadPoolKey threadPoolKey, IHystrixCommandOptions properties, HystrixEventNotifier eventNotifier) : base(null)
        {
            this.key           = key;
            this.group         = commandGroup;
            this.threadPoolKey = threadPoolKey;
            this.properties    = properties;

            healthCountsStream = HealthCountsStream.GetInstance(key, properties);
            rollingCommandEventCounterStream    = RollingCommandEventCounterStream.GetInstance(key, properties);
            cumulativeCommandEventCounterStream = CumulativeCommandEventCounterStream.GetInstance(key, properties);

            rollingCommandLatencyDistributionStream     = RollingCommandLatencyDistributionStream.GetInstance(key, properties);
            rollingCommandUserLatencyDistributionStream = RollingCommandUserLatencyDistributionStream.GetInstance(key, properties);
            rollingCommandMaxConcurrencyStream          = RollingCommandMaxConcurrencyStream.GetInstance(key, properties);
        }
        internal static void Reset()
        {
            foreach (HystrixCommandMetrics metricsInstance in GetInstances())
            {
                metricsInstance.UnsubscribeAll();
            }

            RollingCommandEventCounterStream.Reset();
            CumulativeCommandEventCounterStream.Reset();
            RollingCommandLatencyDistributionStream.Reset();
            RollingCommandUserLatencyDistributionStream.Reset();
            RollingCommandMaxConcurrencyStream.Reset();
            HystrixThreadEventStream.Reset();
            HealthCountsStream.Reset();

            Metrics.Clear();
        }