public HystrixDashboardStream.DashboardData GetTestData()
        {
            var commandKey   = new HystrixCommandKeyDefault("command");
            var tpKey        = new HystrixThreadPoolKeyDefault("threadPool");
            var collapserKey = new HystrixCollapserKeyDefault("collapser");

            var commandMetric = new HystrixCommandMetrics(
                commandKey,
                new HystrixCommandGroupKeyDefault("group"),
                tpKey,
                new HystrixCommandOptions(),
                HystrixEventNotifierDefault.GetInstance());
            var threadPoolMetric = HystrixThreadPoolMetrics.GetInstance(
                tpKey,
                new HystrixSyncTaskScheduler(new HystrixThreadPoolOptions()),
                new HystrixThreadPoolOptions());
            var commandMetrics = new List <HystrixCommandMetrics>()
            {
                commandMetric
            };
            var collapserOptions  = new HystrixCollapserOptions(collapserKey);
            var threadPoolMetrics = new List <HystrixThreadPoolMetrics>()
            {
                threadPoolMetric
            };

            var collapserMetrics = new List <HystrixCollapserMetrics>()
            {
                HystrixCollapserMetrics.GetInstance(collapserKey, collapserOptions)
            };

            return(new HystrixDashboardStream.DashboardData(commandMetrics, threadPoolMetrics, collapserMetrics));
        }
        public HystrixThreadPoolDefault(IHystrixThreadPoolKey threadPoolKey, IHystrixThreadPoolOptions propertiesDefaults)
        {
            _properties = HystrixOptionsFactory.GetThreadPoolOptions(threadPoolKey, propertiesDefaults);
            _properties = propertiesDefaults ?? new HystrixThreadPoolOptions(threadPoolKey);
            var concurrencyStrategy = HystrixPlugins.ConcurrencyStrategy;

            _queueSize     = _properties.MaxQueueSize;
            _metrics       = HystrixThreadPoolMetrics.GetInstance(threadPoolKey, concurrencyStrategy.GetTaskScheduler(_properties), _properties);
            _taskScheduler = _metrics.TaskScheduler;

            /* strategy: HystrixMetricsPublisherThreadPool */
            HystrixMetricsPublisherFactory.CreateOrRetrievePublisherForThreadPool(threadPoolKey, _metrics, _properties);
        }
Example #3
0
        public HystrixThreadPoolDefault(IHystrixThreadPoolKey threadPoolKey, IHystrixThreadPoolOptions propertiesDefaults)
        {
            this.properties = HystrixOptionsFactory.GetThreadPoolOptions(threadPoolKey, propertiesDefaults);
            this.properties = propertiesDefaults ?? new HystrixThreadPoolOptions(threadPoolKey);
            HystrixConcurrencyStrategy concurrencyStrategy = HystrixPlugins.ConcurrencyStrategy;

            this.queueSize     = properties.MaxQueueSize;
            this.metrics       = HystrixThreadPoolMetrics.GetInstance(threadPoolKey, concurrencyStrategy.GetTaskScheduler(properties), properties);
            this.taskScheduler = this.metrics.TaskScheduler;

            /* strategy: HystrixMetricsPublisherThreadPool */
            HystrixMetricsPublisherFactory.CreateOrRetrievePublisherForThreadPool(threadPoolKey, this.metrics, this.properties);
        }