public async Task <string> GetThreadPoolJson(IHystrixCommand command) { IHystrixThreadPoolMetrics threadPoolMetrics = command.ThreadPoolMetrics; string serializeObject = JsonConvert.SerializeObject(new { type = "HystrixThreadPool", name = command.CommandIdentifier.CommandKey, currentTime = DateTimeProvider.GetCurrentTimeInMilliseconds(), currentActiveCount = threadPoolMetrics.GetCurrentActiveCount(), currentCompletedTaskCount = threadPoolMetrics.GetCurrentCompletedTaskCount(), currentCorePoolSize = threadPoolMetrics.GetCurrentCorePoolSize(), currentLargestPoolSize = threadPoolMetrics.GetCurrentLargestPoolSize(), currentMaximumPoolSize = threadPoolMetrics.GetCurrentMaximumPoolSize(), currentPoolSize = threadPoolMetrics.GetCurrentPoolSize(), currentQueueSize = threadPoolMetrics.GetCurrentQueueSize(), currentTaskCount = threadPoolMetrics.GetCurrentTaskCount(), rollingCountThreadsExecuted = threadPoolMetrics.GetRollingCountThreadsExecuted(), rollingMaxActiveThreads = threadPoolMetrics.GetRollingMaxActiveThreads(), rollingCountCommandRejections = threadPoolMetrics.GetRollingCountThreadPoolRejected(), propertyValue_queueSizeRejectionThreshold = 0, //threadPoolMetrics.ConfigurationService.queueSizeRejectionThreshold().get(), propertyValue_metricsRollingStatisticalWindowInMilliseconds = threadPoolMetrics.ConfigurationService.GetMetricsRollingStatisticalWindowInMilliseconds(), reportingHosts = 1 }); return(await Task.FromResult(serializeObject).ConfigureAwait(false)); }
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; }