接口吞吐量监控

拉格纳罗斯

一、特点

特点1

监控接口吞吐量

特点2

不需要侵入原先的代码逻辑

特点3

有个友好的交互界面直观的查看接口吞吐量

二、功能

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

功能1

我们可以重新自定义各个controller中的接口映射地址
所有实例的吞吐量接口
api.throughput.watch.all=/ui/throughput/watch
打开所有实例的吞吐量接口
api.throughput.open.all=/ui/throughput/open
关闭所有实例的吞吐量接口
api.throughput.close.all=/ui/throughput/close
单个实例的吞吐量接口
api.throughput.watch.single=/api/throughput/watch
打开单个实例的吞吐量接口
api.throughput.open.single=/api/throughput/open
关闭单个实例的吞吐量接口
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实现部分接口,或者直接实现接口DistributedService,然后就可以获取其他实例的吞吐量信息

最后

ui.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容