【问题标题】:How to check Matrics properties are working for hystrix?如何检查矩阵属性是否适用于 hystrix?
【发布时间】:2017-11-07 08:35:38
【问题描述】:

我的 local.properties 文件 hystrix 属性如下。

hystrix.command.FASTSearchPageCommand.execution.isolation.strategy=THREAD
hystrix.command.FASTSearchPageCommand.execution.isolation.semaphore.maxConcurrentRequests=10
hystrix.command.FASTSearchPageCommand.execution.isolation.thread.timeoutInMilliseconds=1000

hystrix.command.FASTSearchPageCommand.execution.timeout.disabled=true
hystrix.command.FASTSearchPageCommand.execution.timeout.enabled=false

hystrix.command.FASTSearchPageCommand.execution.isolation.thread.interruptOnTimeout=true
hystrix.command.FASTSearchPageCommand.fallback.isolation.semaphore.maxConcurrentRequests=10
hystrix.command.FASTSearchPageCommand.fallback.disabled=false
hystrix.command.FASTSearchPageCommand.fallback.enabled=true


hystrix.command.FASTSearchPageCommand.circuitBreaker.disabled=false
hystrix.command.FASTSearchPageCommand.circuitBreaker.enabled=true
hystrix.command.FASTSearchPageCommand.circuitBreaker.requestVolumeThreshold=10
hystrix.command.FASTSearchPageCommand.circuitBreaker.sleepWindowInMilliseconds=8000
hystrix.command.FASTSearchPageCommand.circuitBreaker.errorThresholdPercentage=10
hystrix.command.FASTSearchPageCommand.circuitBreaker.forceOpen=false
hystrix.command.FASTSearchPageCommand.circuitBreaker.forceClosed=false
hystrix.command.FASTSearchPageCommand.metrics.rollingStats.timeInMilliseconds=1000
hystrix.command.FASTSearchPageCommand.metrics.rollingStats.numBuckets=5
hystrix.command.FASTSearchPageCommand.metrics.rollingPercentile.enabled=true
hystrix.command.FASTSearchPageCommand.metrics.rollingPercentile.timeInMilliseconds=100
hystrix.command.FASTSearchPageCommand.metrics.rollingPercentile.bucketSize=10
hystrix.command.FASTSearchPageCommand.metrics.healthSnapshot.intervalInMilliseconds=100
fastSearch.executionTimeout=5000

那么我怎样才能检查所有的工作。就像我怎么能注意到我的矩阵属性正在工作。如果可以给我一些运行和回退方法的代码。

【问题讨论】:

    标签: hybris hystrix netflix


    【解决方案1】:

    我想你可以在这里找到所有文档:Hystrix docs

    从他们的文档中获取的示例如下:

    public class CommandThatFailsSilently extends HystrixCommand<String> {
    
        private final boolean throwException;
    
        public CommandThatFailsSilently(boolean throwException) {
            super(HystrixCommandGroupKey.Factory.asKey("FASTSearchPageCommand"));
            this.throwException = throwException;
        }
    
        @Override
        protected String run() {
            if (throwException) {
                throw new RuntimeException("failure from CommandThatFailsFast");
            } else {
                return "success";
            }
        }
    
        @Override
        protected String getFallback() {
            return null;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-09
      • 2022-01-15
      • 1970-01-01
      • 2019-07-31
      • 2023-04-08
      • 1970-01-01
      • 2013-05-17
      • 1970-01-01
      相关资源
      最近更新 更多