hystrixのgrpc回路ブレーカ

前の章では、grpcブレーカーセンチネルを提供し、

grpc回路ブレーカをセンチネル

しかし、警報のために、同社のオンラインシステムのコンポーネントを監視はプロメテウスで、まだプロメテウスを統合しないセンチネルので、ここではいくつかのオンラインシステムやhystrixであります

ステップ

1、POM依存
<dependency>
            <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-netflix-hystrix</artifactid> </dependency> 
2、クラスまたはクラス構成増加を開始@EnableHystrix
3、hystrixCommendコメントを高めます
 @PostMapping("/grpc")
    @HystrixCommand(fallbackMethod = "fallbackMethod")
    public BaseResponse doGrpc(@RequestBody ReRequest rr){ ...... ....... } public BaseResponse fallbackMethod(@RequestBody ReRequest rr){ ...... ....... } 
図4に示すように、増加した構成をYML
feign:
  hystrix:
    enabled: true
  okhttp: enabled: true httpclient: enabled: false compression: request: enabled: true response: enabled: true hystrix: command: default: execution: timeout: enabled: true isolation: thread: timeoutInMilliseconds: 1000 circuitBreaker: requestVolumeThreshold: 50 threadpool: default: coreSize: 60 maxQueueSize: 200 queueSizeRejectionThreshold: 200 

grpcタイムアウトがあることを注意は、grpcタイムアウトよりも大きくする必要があり、ここでタイムアウトブレーカーを設定します。

ここに画像を挿入説明ここに画像を挿入説明

 

おすすめ

転載: www.cnblogs.com/1994jinnan/p/12578078.html