标签:好处 overflow cti 框架 use nis string att als
一般使用 hystrix.Do来跟踪请求,需要传入请求名,所以正则匹配一下想要自定义配置的请求名。然后这样:
这是go-hystrix下doc.go里面的内容,vender源码到项目的好处之一是可以轻松查看框架资料!
Synchronous API
Since calling a command and immediately waiting for it to finish is a common pattern, a synchronous API is available with the Do function which returns a single error.
err := hystrix.Do("my_command", func() error {
// talk to other services
return nil
}, nil)
Configure settings
During application boot, you can call ConfigureCommand to tweak the settings for each command.
hystrix.ConfigureCommand("my_command", hystrix.CommandConfig{
Timeout: 1000,
MaxConcurrentRequests: 100,
ErrorPercentThreshold: 25,
})
You can also use Configure which accepts a map[string]CommandConfig.
标签:好处 overflow cti 框架 use nis string att als
原文地址:https://www.cnblogs.com/amtisy/p/13609114.html