拉格納羅斯
一、特點(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