1 回答

TA貢獻2016條經驗 獲得超9個贊
在遵循整個自定義 hystrix 指標綁定過程之后,我最終發現一切都被正確綁定,至少在原則上是這樣。
然后,我嘗試在第一次執行 hystrix 命令時觸發斷點,以檢查注冊表和發布者的情況。在方法中放置斷點
HystrixMetricsPublisherThreadPool getPublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties)
在HystrixMetricsPublisherFactory課堂上,我發現該HystrixPlugins實例與設置發布者的時刻不同。檢查應用程序的所有代碼后,我發現為了設置自定義事件通知程序,實例正在重置。
@EventListener(ApplicationReadyEvent.class)
public void doAfterStartup() {
Hystrix.reset();
registerCustomHystrixEventNotifier(circuitBreakerHystrixEventNotifier);
logger.info("hello world, application started up");
}
然后,我修改了該方法以注冊事件通知程序,而無需重置之前配置的自動配置,并且 hystrix 指標現在顯示在 prometheus 端點中。
添加回答
舉報