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 HelloController() { var helper = new AspNetHystrixCommandFactoryHelper(); var factory = helper.CreateFactory(); hystrixCommand = factory.GetHystrixCommand("TestGroup", "TestCommand"); }
public TransformationServices(IHystrixCommandFactory hystrixCommandFactory) { hystrixCommand = hystrixCommandFactory.GetHystrixCommand("TestGroup", "TestCommand"); }
public async Task <string> GetCommandJson(IHystrixCommand command) { var commandIdentifier = command.CommandIdentifier; var circuitBreaker = command.CircuitBreaker; var commandMetrics = command.CommandMetrics; var configurationService = commandMetrics.ConfigurationService; var healthCounts = commandMetrics.GetHealthCounts(); string serializeObject = JsonConvert.SerializeObject(new { type = "HystrixCommand", name = commandIdentifier.CommandKey, group = commandIdentifier.GroupKey, currentTime = DateTimeProvider.GetCurrentTimeInMilliseconds(), isCircuitBreakerOpen = circuitBreaker != null && circuitBreaker.CircuitIsOpen, errorPercentage = healthCounts.GetErrorPercentage(), errorCount = healthCounts.GetErrorCount(), requestCount = healthCounts.GetTotalRequests(), // rolling counters rollingCountBadRequests = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.BadRequest), rollingCountCollapsedRequests = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.Collapsed), rollingCountEmit = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.Emit), rollingCountExceptionsThrown = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.ExceptionThrown), rollingCountFailure = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.Failure), rollingCountFallbackEmit = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.FallbackEmit), rollingCountFallbackFailure = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.FallbackFailure), rollingCountFallbackMissing = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.FallbackMissing), rollingCountFallbackRejection = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.FallbackRejection), rollingCountFallbackSuccess = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.FallbackSuccess), rollingCountResponsesFromCache = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.ResponseFromCache), rollingCountSemaphoreRejected = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.SemaphoreRejected), rollingCountShortCircuited = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.ShortCircuited), rollingCountSuccess = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.Success), rollingCountThreadPoolRejected = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.ThreadPoolRejected), rollingCountTimeout = commandMetrics.GetRollingSum(HystrixRollingNumberEvent.Timeout), currentConcurrentExecutionCount = commandMetrics.GetCurrentConcurrentExecutionCount(), rollingMaxConcurrentExecutionCount = commandMetrics.GetRollingMaxConcurrentExecutions(), // latency percentiles latencyExecute_mean = commandMetrics.GetExecutionTimeMean(), latencyExecute = new Dictionary <string, int> { { "0", commandMetrics.GetExecutionTimePercentile(0) }, { "25", commandMetrics.GetExecutionTimePercentile(25) }, { "50", commandMetrics.GetExecutionTimePercentile(50) }, { "75", commandMetrics.GetExecutionTimePercentile(75) }, { "90", commandMetrics.GetExecutionTimePercentile(90) }, { "95", commandMetrics.GetExecutionTimePercentile(95) }, { "99", commandMetrics.GetExecutionTimePercentile(99) }, { "99.5", commandMetrics.GetExecutionTimePercentile(99.5) }, { "100", commandMetrics.GetExecutionTimePercentile(100) } }, latencyTotal_mean = commandMetrics.GetTotalTimeMean(), latencyTotal = new Dictionary <string, int> { { "0", commandMetrics.GetTotalTimePercentile(0) }, { "25", commandMetrics.GetTotalTimePercentile(25) }, { "50", commandMetrics.GetTotalTimePercentile(50) }, { "75", commandMetrics.GetTotalTimePercentile(75) }, { "90", commandMetrics.GetTotalTimePercentile(90) }, { "95", commandMetrics.GetTotalTimePercentile(95) }, { "99", commandMetrics.GetTotalTimePercentile(99) }, { "99.5", commandMetrics.GetTotalTimePercentile(99.5) }, { "100", commandMetrics.GetTotalTimePercentile(100) } }, // property values for reporting what is actually seen by the command rather than what was set somewhere propertyValue_circuitBreakerRequestVolumeThreshold = configurationService.GetCircuitBreakerRequestVolumeThreshold(), propertyValue_circuitBreakerSleepWindowInMilliseconds = configurationService.GetCircuitBreakerSleepWindowInMilliseconds(), propertyValue_circuitBreakerErrorThresholdPercentage = configurationService.GetCircuitBreakerErrorThresholdPercentage(), propertyValue_circuitBreakerForceOpen = configurationService.GetCircuitBreakerForcedOpen(), propertyValue_circuitBreakerForceClosed = configurationService.GetCircuitBreakerForcedClosed(), propertyValue_circuitBreakerEnabled = configurationService.GetHystrixCommandEnabled(), propertyValue_executionIsolationStrategy = "THREAD", // configurationService.GetExecutionIsolationStrategy().Name, propertyValue_executionIsolationThreadTimeoutInMilliseconds = 0, //configurationService.GetExecutionTimeoutInMilliseconds(), propertyValue_executionTimeoutInMilliseconds = configurationService.GetCommandTimeoutInMilliseconds(), propertyValue_executionIsolationThreadInterruptOnTimeout = false, //configurationService.GetExecutionIsolationThreadInterruptOnTimeout(), propertyValue_executionIsolationThreadPoolKeyOverride = (string)null, // configurationService.GetExecutionIsolationThreadPoolKeyOverride(), propertyValue_executionIsolationSemaphoreMaxConcurrentRequests = 0, // configurationService.GetExecutionIsolationSemaphoreMaxConcurrentRequests(), propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests = 0, // configurationService.GetFallbackIsolationSemaphoreMaxConcurrentRequests(), /* * The following are commented out as these rarely change and are verbose for streaming for something people don't change. * We could perhaps allow a property or request argument to include these. */ propertyValue_metricsRollingPercentileEnabled = configurationService.GetMetricsRollingPercentileEnabled(), propertyValue_metricsRollingPercentileBucketSize = configurationService.GetMetricsRollingPercentileBucketSize(), propertyValue_metricsRollingPercentileWindow = configurationService.GetMetricsRollingPercentileWindowInMilliseconds(), propertyValue_metricsRollingPercentileWindowBuckets = configurationService.GetMetricsRollingPercentileWindowBuckets(), propertyValue_metricsRollingStatisticalWindowBuckets = configurationService.GetMetricsRollingStatisticalWindowBuckets(), propertyValue_metricsRollingStatisticalWindowInMilliseconds = configurationService.GetMetricsRollingStatisticalWindowInMilliseconds(), propertyValue_requestCacheEnabled = false, // configurationService.requestCacheEnabled().get(), propertyValue_requestLogEnabled = false, // configurationService.requestLogEnabled().get(), reportingHosts = 1, // this will get summed across all instances in a cluster //threadPool = string.Empty, // commandMetrics.getThreadPoolKey().name(), }); return(await Task.FromResult(serializeObject).ConfigureAwait(false)); }
public HelloController(IHystrixCommandFactory hystrixCommandFactory) { hystrixCommand = hystrixCommandFactory.GetHystrixCommand("TestGroup", "TestCommand"); }
public JsonServices(IHystrixCommandFactory hystrixCommandFactory) { hystrixCommand = hystrixCommandFactory.GetHystrixCommand("JsonGroup", "JsonCommand"); }
public HystrixController(IHystrixCommandFactory hystrixCommandFactory, IHttpClientFactory httpClientFactory) { this.hystrixCommand = hystrixCommandFactory.GetHystrixCommand("GroupKey", "CommandKey"); this.httpClientFactory = httpClientFactory; }
public XmlServices(IHystrixCommandFactory hystrixCommandFactory) { hystrixCommand = hystrixCommandFactory.GetHystrixCommand("XmlGroup", "XmlCommand"); }