public static RollingThreadPoolEventCounterStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
public static CumulativeThreadPoolEventCounterStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingThreadPoolMaxConcurrencyStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
private HystrixThreadPoolConfiguration(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { this(threadPoolKey, threadPoolProperties.coreSize().get(), threadPoolProperties.maximumSize().get(), threadPoolProperties.actualMaximumSize(), threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.keepAliveTimeMinutes().get(), threadPoolProperties.getAllowMaximumSizeToDivergeFromCoreSize().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get()); }
@Test public void testGetUser() throws NoSuchFieldException, IllegalAccessException { User u1 = userService.getUser("1", "name: "); assertEquals("name: 1", u1.getName()); assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size()); HystrixInvokableInfo<?> command = HystrixRequestLog.getCurrentRequest() .getAllExecutedCommands().iterator().next(); assertEquals("GetUserCommand", command.getCommandKey().name()); assertEquals("UserGroupKey", command.getCommandGroup().name()); assertEquals("Test", command.getThreadPoolKey().name()); assertTrue(command.getExecutionEvents().contains(HystrixEventType.SUCCESS)); // assert properties assertEquals(110, command.getProperties().executionTimeoutInMilliseconds().get().intValue()); assertEquals(false, command.getProperties().executionIsolationThreadInterruptOnTimeout().get()); HystrixThreadPoolProperties properties = getThreadPoolProperties(command); assertEquals(30, (int) properties.coreSize().get()); assertEquals(35, (int) properties.maximumSize().get()); assertEquals(true, properties.getAllowMaximumSizeToDivergeFromCoreSize().get()); assertEquals(101, (int) properties.maxQueueSize().get()); assertEquals(2, (int) properties.keepAliveTimeMinutes().get()); assertEquals(15, (int) properties.queueSizeRejectionThreshold().get()); assertEquals(1440, (int) properties.metricsRollingStatisticalWindowInMilliseconds().get()); assertEquals(12, (int) properties.metricsRollingStatisticalWindowBuckets().get()); }
public static CumulativeThreadPoolEventCounterStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingThreadPoolMaxConcurrencyStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
public static RollingThreadPoolEventCounterStream getInstance(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties properties) { final int counterMetricWindow = properties.metricsRollingStatisticalWindowInMilliseconds().get(); final int numCounterBuckets = properties.metricsRollingStatisticalWindowBuckets().get(); final int counterBucketSizeInMs = counterMetricWindow / numCounterBuckets; return getInstance(threadPoolKey, numCounterBuckets, counterBucketSizeInMs); }
private HystrixThreadPoolConfiguration(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) { this(threadPoolKey, threadPoolProperties.coreSize().get(), threadPoolProperties.maximumSize().get(), threadPoolProperties.actualMaximumSize(), threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.keepAliveTimeMinutes().get(), threadPoolProperties.getAllowMaximumSizeToDivergeFromCoreSize().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get()); }
public static TenacityConfiguration getTenacityConfiguration(TenacityPropertyKey key) { final HystrixCommandProperties commandProperties = TenacityCommand.getCommandProperties(key); final HystrixThreadPoolProperties threadPoolProperties = TenacityCommand.getThreadpoolProperties(key); return new TenacityConfiguration( new ThreadPoolConfiguration( threadPoolProperties.coreSize().get(), threadPoolProperties.keepAliveTimeMinutes().get(), threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get()), new CircuitBreakerConfiguration( commandProperties.circuitBreakerRequestVolumeThreshold().get(), commandProperties.circuitBreakerSleepWindowInMilliseconds().get(), commandProperties.circuitBreakerErrorThresholdPercentage().get(), commandProperties.metricsRollingStatisticalWindowInMilliseconds().get(), commandProperties.metricsRollingStatisticalWindowBuckets().get()), new SemaphoreConfiguration( commandProperties.executionIsolationSemaphoreMaxConcurrentRequests().get(), commandProperties.fallbackIsolationSemaphoreMaxConcurrentRequests().get()), commandProperties.executionTimeoutInMilliseconds().get(), commandProperties.executionIsolationStrategy().get()); } }
public static TenacityConfiguration getTenacityConfiguration(TenacityPropertyKey key) { final HystrixCommandProperties commandProperties = TenacityCommand.getCommandProperties(key); final HystrixThreadPoolProperties threadPoolProperties = TenacityCommand.getThreadpoolProperties(key); return new TenacityConfiguration( new ThreadPoolConfiguration( threadPoolProperties.coreSize().get(), threadPoolProperties.keepAliveTimeMinutes().get(), threadPoolProperties.maxQueueSize().get(), threadPoolProperties.queueSizeRejectionThreshold().get(), threadPoolProperties.metricsRollingStatisticalWindowInMilliseconds().get(), threadPoolProperties.metricsRollingStatisticalWindowBuckets().get()), new CircuitBreakerConfiguration( commandProperties.circuitBreakerRequestVolumeThreshold().get(), commandProperties.circuitBreakerSleepWindowInMilliseconds().get(), commandProperties.circuitBreakerErrorThresholdPercentage().get(), commandProperties.metricsRollingStatisticalWindowInMilliseconds().get(), commandProperties.metricsRollingStatisticalWindowBuckets().get()), new SemaphoreConfiguration( commandProperties.executionIsolationSemaphoreMaxConcurrentRequests().get(), commandProperties.fallbackIsolationSemaphoreMaxConcurrentRequests().get()), commandProperties.executionTimeoutInMilliseconds().get(), commandProperties.executionIsolationStrategy().get()); } }