接口吞吐量監(jiān)控

拉格納羅斯

一、特點(diǎn)

特點(diǎn)1

監(jiān)控接口吞吐量

特點(diǎn)2

不需要侵入原先的代碼邏輯

特點(diǎn)3

有個(gè)友好的交互界面直觀的查看接口吞吐量

二、功能

<dependency>
      <groupId>com.github.wangcanfeng01</groupId>
      <artifactId>freedom-ragnaros</artifactId>
      <version>1.0.RELEASE</version>
</dependency>

功能1

我們可以重新自定義各個(gè)controller中的接口映射地址
所有實(shí)例的吞吐量接口
api.throughput.watch.all=/ui/throughput/watch
打開所有實(shí)例的吞吐量接口
api.throughput.open.all=/ui/throughput/open
關(guān)閉所有實(shí)例的吞吐量接口
api.throughput.close.all=/ui/throughput/close
單個(gè)實(shí)例的吞吐量接口
api.throughput.watch.single=/api/throughput/watch
打開單個(gè)實(shí)例的吞吐量接口
api.throughput.open.single=/api/throughput/open
關(guān)閉單個(gè)實(shí)例的吞吐量接口
api.throughput.close.single=/api/throughput/close

功能2

具體功能使用說明

@Component
@ThroughputScan
public class ExampleClass {

    @Throughput(name = "wcf.test")
    public String test() {
        try {
            TimeUnit.MILLISECONDS.sleep(30);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "started";
    }
}
@UseRagnaros
@Component
public class RagnarosConfiguration  implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/ragnaros.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
}

功能3

可以繼承抽象類AbstractDistributedService實(shí)現(xiàn)部分接口,或者直接實(shí)現(xiàn)接口DistributedService,然后就可以獲取其他實(shí)例的吞吐量信息

最后

ui.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容