public HystrixRollingPercentile(IDateTimeProvider dateTimeProvider, int timeInMilliseconds, int numberOfBuckets, int bucketDataLength, IHystrixConfigurationService configurationService)
        {
            if (timeInMilliseconds <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(timeInMilliseconds), "Parameter timeInMilliseconds needs to be greater than 0");
            }
            if (numberOfBuckets <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(numberOfBuckets), "Parameter numberOfBuckets needs to be greater than 0");
            }
            if (timeInMilliseconds % numberOfBuckets != 0)
            {
                throw new ArgumentOutOfRangeException(nameof(timeInMilliseconds), "Parameter timeInMilliseconds needs to be an exact multiple of numberOfBuckets");
            }
            if (bucketDataLength < 100)
            {
                throw new ArgumentOutOfRangeException(nameof(bucketDataLength), "Parameter bucketDataLength needs to be greater than or equal to 100");
            }

            this.timeInMilliseconds   = timeInMilliseconds;
            this.numberOfBuckets      = numberOfBuckets;
            this.bucketDataLength     = bucketDataLength;
            this.dateTimeProvider     = dateTimeProvider ?? throw new ArgumentNullException(nameof(dateTimeProvider));
            this.configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));

            bucketSizeInMilliseconds = this.timeInMilliseconds / this.numberOfBuckets;

            buckets = new CircularArray <RollingPercentileBucket>(this.numberOfBuckets);
        }
Example #2
0
        public HystrixCommand(HystrixCommandIdentifier commandIdentifier, IHystrixTimeoutWrapper timeoutWrapper, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandMetrics commandMetrics, IHystrixThreadPoolMetrics threadPoolMetrics, IHystrixConfigurationService configurationService)
        {
            if (commandIdentifier == null)
            {
                throw new ArgumentNullException("commandIdentifier");
            }
            if (timeoutWrapper == null)
            {
                throw new ArgumentNullException("timeoutWrapper");
            }
            if (circuitBreaker == null)
            {
                throw new ArgumentNullException("circuitBreaker");
            }
            if (commandMetrics == null)
            {
                throw new ArgumentNullException("commandMetrics");
            }
            if (threadPoolMetrics == null)
            {
                throw new ArgumentNullException("threadPoolMetrics");
            }
            if (configurationService == null)
            {
                throw new ArgumentNullException("configurationService");
            }

            this.commandIdentifier    = commandIdentifier;
            this.timeoutWrapper       = timeoutWrapper;
            this.circuitBreaker       = circuitBreaker;
            this.commandMetrics       = commandMetrics;
            this.threadPoolMetrics    = threadPoolMetrics;
            this.configurationService = configurationService;
        }
Example #3
0
 public HystrixCircuitBreaker(IDateTimeProvider dateTimeProvider, HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService, IHystrixCommandMetrics commandMetrics)
 {
     this.dateTimeProvider     = dateTimeProvider ?? throw new ArgumentNullException(nameof(dateTimeProvider));
     this.commandIdentifier    = commandIdentifier ?? throw new ArgumentNullException(nameof(commandIdentifier));
     this.configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));
     this.commandMetrics       = commandMetrics ?? throw new ArgumentNullException(nameof(commandMetrics));
 }
Example #4
0
        public HystrixCommandMetrics(IDateTimeProvider dateTimeProvider, IHystrixConfigurationService configurationService)
        {
            this.dateTimeProvider     = dateTimeProvider ?? throw new ArgumentNullException(nameof(dateTimeProvider));
            this.configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));

            percentileExecution = new HystrixRollingPercentile(dateTimeProvider, configurationService.GetMetricsRollingPercentileWindowInMilliseconds(), configurationService.GetMetricsRollingPercentileWindowBuckets(), configurationService.GetMetricsRollingPercentileBucketSize(), configurationService);
            percentileTotal     = new HystrixRollingPercentile(dateTimeProvider, configurationService.GetMetricsRollingPercentileWindowInMilliseconds(), configurationService.GetMetricsRollingPercentileWindowBuckets(), configurationService.GetMetricsRollingPercentileBucketSize(), configurationService);

            counter = new HystrixRollingNumber(dateTimeProvider, configurationService.GetMetricsRollingStatisticalWindowInMilliseconds(), configurationService.GetMetricsRollingStatisticalWindowBuckets());
        }
Example #5
0
        public HystrixThreadPoolMetrics(HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService)
        {
            if (commandIdentifier == null)
            {
                throw new ArgumentNullException(nameof(commandIdentifier));
            }
            if (configurationService == null)
            {
                throw new ArgumentNullException(nameof(configurationService));
            }
            ConfigurationService = configurationService;

            counter = new HystrixRollingNumber(configurationService.GetMetricsRollingStatisticalWindowInMilliseconds(), configurationService.GetMetricsRollingStatisticalWindowBuckets());
        }
        public HystrixTimeoutWrapper(HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService)
        {
            if (commandIdentifier == null)
            {
                throw new ArgumentNullException(nameof(commandIdentifier));
            }
            if (configurationService == null)
            {
                throw new ArgumentNullException(nameof(configurationService));
            }

            this.commandIdentifier    = commandIdentifier;
            this.configurationService = configurationService;
        }
        public HystrixCommandMetrics(DateTimeProvider dateTimeProvider, HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService)
        {
            if (commandIdentifier == null)
            {
                throw new ArgumentNullException("commandIdentifier");
            }
            if (configurationService == null)
            {
                throw new ArgumentNullException("configurationService");
            }

            this.dateTimeProvider     = dateTimeProvider;
            this.commandIdentifier    = commandIdentifier;
            this.configurationService = configurationService;

            percentileExecution = new HystrixRollingPercentile(configurationService.GetMetricsRollingPercentileWindowInMilliseconds(), configurationService.GetMetricsRollingPercentileWindowBuckets(), configurationService.GetMetricsRollingPercentileBucketSize(), configurationService);
            percentileTotal     = new HystrixRollingPercentile(configurationService.GetMetricsRollingPercentileWindowInMilliseconds(), configurationService.GetMetricsRollingPercentileWindowBuckets(), configurationService.GetMetricsRollingPercentileBucketSize(), configurationService);

            counter = new HystrixRollingNumber(configurationService.GetMetricsRollingStatisticalWindowInMilliseconds(), configurationService.GetMetricsRollingStatisticalWindowBuckets());
        }
Example #8
0
        public HystrixCircuitBreaker(DateTimeProvider dateTimeProvider, HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService, IHystrixCommandMetrics commandMetrics)
        {
            if (commandIdentifier == null)
            {
                throw new ArgumentNullException("commandIdentifier");
            }
            if (configurationService == null)
            {
                throw new ArgumentNullException("configurationService");
            }
            if (commandMetrics == null)
            {
                throw new ArgumentNullException("commandMetrics");
            }

            this.dateTimeProvider     = dateTimeProvider;
            this.commandIdentifier    = commandIdentifier;
            this.configurationService = configurationService;
            this.commandMetrics       = commandMetrics;
        }
 public HystrixCommandMetrics(HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService)
     : this(new DateTimeProvider(), commandIdentifier, configurationService)
 {
 }
Example #10
0
        public HystrixThreadPoolMetrics(IDateTimeProvider dateTimeProvider, IHystrixConfigurationService configurationService)
        {
            ConfigurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));

            counter = new HystrixRollingNumber(dateTimeProvider, configurationService.GetMetricsRollingStatisticalWindowInMilliseconds(), configurationService.GetMetricsRollingStatisticalWindowBuckets());
        }
 public HystrixCircuitBreaker(HystrixCommandIdentifier commandIdentifier, IHystrixConfigurationService configurationService, IHystrixCommandMetrics commandMetrics)
     : this(new DateTimeProvider(), commandIdentifier, configurationService, commandMetrics)
 {
 }
 public HystrixRollingPercentile(int timeInMilliseconds, int numberOfBuckets, int bucketDataLength, IHystrixConfigurationService configurationService)
     : this(new DateTimeProvider(), timeInMilliseconds, numberOfBuckets, bucketDataLength, configurationService)
 {
 }