2015-07-03 2 views
9

मुझे एक ही समस्या है, जहां मैं application.yaml में hystrix गुणों को ओवरराइड करने का प्रयास कर रहा हूं। जब मैं ऐप चलाता हूं & स्थानीयहोस्ट के साथ गुणों की जांच करें: पोर्ट/ऐप-संदर्भ/hystrix.stream, मुझे इसके बजाय सभी डिफ़ॉल्ट मान मिलते हैं।स्प्रिंग-बूट अनुप्रयोग में application.yaml का उपयोग कर hystrix कमांड गुणों को कॉन्फ़िगर करना

यहाँ मेरी application.yaml में hystrix config है

hystrix: 
    command.StoreSubmission.execution.isolation.thread.timeoutInMilliseconds: 30000 
    command.StoreSubmission.circuitBreaker.requestVolumeThreshold: 4 
    command.StoreSubmission.circuitBreaker.sleepWindowInMilliseconds: 60000 
    command.StoreSubmission.metrics.rollingStats.timeInMilliseconds: 180000 
    collapser.StoreSubmission.maxRequestsInBatch: 1 
    collapser.StoreSubmission.requestCache.enabled: FALSE 
    threadpool.StoreSubmission.coreSize: 30 
    threadpool.StoreSubmission.metrics.rollingStats.timeInMilliseconds: 180000 

यहाँ मैं क्या देख जब मैं यूआरएल मारा है - स्थानीय होस्ट: पोर्ट/एप्लिकेशन संदर्भ ब्राउज़र में/hystrix.stream [यह एक ही धारा है hystrix डैशबोर्ड] के लिए इस्तेमाल किया यूआरएल -

data: {"type":"HystrixCommand","name":"storeSubmission","group":"StoreSubmission","currentTime":1435941064801,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0,"requestCount":0,"rollingCountCollapsedRequests":0,"rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackFailure":0,"rollingCountFallbackRejection":0,"rollingCountFallbackSuccess":0,"rollingCountResponsesFromCache":0,"rollingCountSemaphoreRejected":0,"rollingCountShortCircuited":0,"rollingCountSuccess":0,"rollingCountThreadPoolRejected":0,"rollingCountTimeout":0,"currentConcurrentExecutionCount":0,"latencyExecute_mean":0,"latencyExecute":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"latencyTotal_mean":0,"latencyTotal":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"propertyValue_circuitBreakerRequestVolumeThreshold":20,"propertyValue_circuitBreakerSleepWindowInMilliseconds":5000,"propertyValue_circuitBreakerErrorThresholdPercentage":50,"propertyValue_circuitBreakerForceOpen":false,"propertyValue_circuitBreakerForceClosed":false,"propertyValue_circuitBreakerEnabled":true,"propertyValue_executionIsolationStrategy":"THREAD","propertyValue_executionIsolationThreadTimeoutInMilliseconds":1000,"propertyValue_executionIsolationThreadInterruptOnTimeout":true,"propertyValue_executionIsolationThreadPoolKeyOverride":null,"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"propertyValue_requestCacheEnabled":true,"propertyValue_requestLogEnabled":true,"reportingHosts":1} 

data: {"type":"HystrixThreadPool","name":"StoreSubmission","currentTime":1435941064801,"currentActiveCount":0,"currentCompletedTaskCount":35,"currentCorePoolSize":30,"currentLargestPoolSize":30,"currentMaximumPoolSize":30,"currentPoolSize":30,"currentQueueSize":0,"currentTaskCount":35,"rollingCountThreadsExecuted":0,"rollingMaxActiveThreads":0,"propertyValue_queueSizeRejectionThreshold":5,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":180000,"reportingHosts":1} 

समस्या hystrix आदेश & collapser गुण, के रूप में ThreadPool गुण सही ढंग से स्थापित कर रहे हैं, जहां के साथ है। मैं अपने @configuration कक्षा में एनोटेशन निम्नलिखित मिल गया है -

@EnableAutoConfiguration(exclude=MongoAutoConfiguration.class) 
@EnableHystrix 
@EnableHystrixDashboard 

कोई उनके वसंत-बूट आवेदन में application.yaml का उपयोग कर hystrix आदेश गुण को विन्यस्त की कोशिश की है, कृपया मदद कर सकते हैं?

+0

मैं इसे देख रहा हूं और ध्यान दें कि HystrixCommand डेटा से आने वाला नाम कम मामला है और आपकी कॉन्फ़िगरेशन अपरकेस है। – spencergibb

+0

मैंने आपके मूल्यों को अपने 'application.yml' में चिपकाया और उन मानों के माध्यम से आया। – spencergibb

+0

@spencergibb: 1. HystrixCommand डेटा में आने वाला नाम विधि नाम है जिसे HystrixCommand द्वारा लपेटा गया था। 2. कॉन्फ़िगरेशन में इसके समूह की मान, actaully यह कमांड होना चाहिए मूल्य। 3. जब आप कहते हैं कि ये मूल्य आते हैं, कहां? – Amrut

उत्तर

16

मुख्य समस्या यह थी कि, मैं गुणों को परिभाषित करने के लिए कमांडके मान के बजाय groupKey मान का उपयोग कर रहा था। इन configurtion गुण के लिए विकी पेज - https://github.com/Netflix/Hystrix/wiki/Configuration#intro कहते हैं -

hystrix.command.HystrixCommandKey.execution.isolation.thread.timeoutInMilliseconds 

मूल्य आप commandkey के लिए सेट के साथ संपत्ति के HystrixCommandKey भाग बदलें।

hystrix.threadpool.HystrixThreadPoolKey.coreSize 

मूल्य आप threadPoolKey के लिए सेट के साथ संपत्ति के HystrixThreadPoolKey भाग बदलें।

@HystrixCommand(groupKey = "StoreSubmission", commandKey = "StoreSubmission", threadPoolKey = "StoreSubmission") 
public String storeSubmission(ReturnType returnType, InputStream is, String id) { 
} 

आप वास्तव में दोनों commnad पद्धति पर & ThreadPool गुण भीतर @HystixCommand एनोटेशन परिभाषित कर सकते हैं - मैं विधि HystrixCommand से लिपटे पर दोनों commandKey & threadPoolKey कैसे परिभाषित

यहाँ है।

@HystrixCommand(groupKey = "StoreSubmission", commandKey = "StoreSubmission", threadPoolKey = "StoreSubmission", commandProperties = { 
     @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "30000"), 
     @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "4"), 
     @HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "60000"), 
     @HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "180000") }, threadPoolProperties = { 
     @HystrixProperty(name = "coreSize", value = "30"), 
     @HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "180000") }) 
public String storeSubmission(ReturnType returnType, InputStream is, String id) { 
} 

मैं इन गुणों को परिभाषित करने के लिए सबसे अच्छा तरीका externalized application.yaml में है, कि जिस तरह से आप यह बेहतर नियंत्रित कर सकते हैं & उन्हें अलग वातावरण के लिए बदलने लगता है।

+0

क्या आप जानते हैं कि मैं यह कैसे सत्यापित कर सकता हूं कि इन गुणों को HystrixCommand को कॉन्फ़िगर करने के लिए लागू किया जा रहा है? क्या उन्हें लॉगिंग करने के वैसे भी है? क्या हाइस्ट्रिक्स के लिए DEBUG स्तर लॉगिंग सक्षम करना संभव है? – pijushcse

संबंधित मुद्दे