1 Star 0 Fork 3

重阳的小马 / task-tool接口调用统计工具

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

task-tool spring接口调用统计工具

服务内统计接口方法的执行次数,时间,最近错误,最大执行时长等看每个需要监控的方法的执行情况,以便于快速发现性能问题。

目的

1,在系统开发完后,接口的使用情况,没办法直观的知道使用情况。
2,通过这个工具来统计,调用次数,异常次数,异常发生时间,异常信息,最大执行时长等,最大执行时长发生成的时间等,来方便查看接口的运行情况。
3,统计后台任务如Schedule定时任务,自动任务,mq任务等的调用情况
4,异常访问系统接口,部份管理员在非正常时间,调用非正常权限接口,也可以快速查出来,透过接口可以分析用户行为是否正常
5,统计分析性能问题的接口,快速找出性能瓶颈点。

功能特性

  • 支持springboot,springmvc
  • 统计信息含(调用次数,最近调用时间,最长执行时间(执行时长、发生时间、对应ID)异常错误(次数、最近发生时间,对应ID))
  • 支持按分钟,小时、天等维度统计相关信息。
  • 支持uri接口的计用次数统计(可以分别计算每个来源的调用次数)
  • 支持Controller调用统计(不用加注解,根据配置的包名生效)
  • 支持TaskCompute的spring内部调用次数统计,来源默认为空
  • 支持TaskComputeServlet统计servlet调用次数
  • 支持scheduler任务的次数统计
  • 支持mq的消费次数统计
  • 有控制台显示执行信息
  • 用hashmap当缓存,性能超好,并且异步进行保存避免影响功能本身的性能。

Quick Start

http://localhost:8080/index.html
http://task-tool-demo.opendfl.org.cn/index.html

使用

  • 1 maven引入依赖包

<dependency>
    <groupId>cn.org.opendfl</groupId>
    <artifactId>task-tool</artifactId>
    <version>2.1</version>
</dependency>

如果需要定时自动保存到数据库可引入下面这个


<dependency>
    <groupId>cn.org.opendfl</groupId>
    <artifactId>task-tool-db</artifactId>
    <version>2.0</version>
</dependency>
  • 2,在要统计方法上加上@TaskCompute注解

@Service
public class TaskTestBiz implements ITaskTestBiz {
    @TaskCompute
    @Override
    public String hello(String name) {
        try {
            Thread.sleep(4000L);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        return "hello " + name;
    }
}
  • 3,配置
    • springboot支持任务统计,加scanBasePackages={"cn.org.opendfl.tasktool"}
      @SpringBootApplication(scanBasePackages = {"cn.org.opendfl.tasktool"})
    • springboot支持保存到数据库,加scanBasePackages = {"cn.org.opendfl.task", "cn.org.opendfl.tasktool"}
      @SpringBootApplication(scanBasePackages = {"cn.org.opendfl.task", "cn.org.opendfl.tasktool")
      @MapperScan(basePackages = "cn.org.opendfl.task")
      
  • 4,接口有调用后查看结果加scanBasePackages=cn.org.opendfl.tasktool,

http://localhost:8080/taskInfo/runInfo?key=tasktooltest

  • 5,查看配置信息

http://localhost:8080/taskInfo/config?key=tasktooltest

MIT License Copyright (c) 2022 chenjh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

服务内统计接口方法的执行次数,时间,最近错误,最大执行时长等看每个需要监控的方法的执行情况,以便于快速发现性能问题。 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/renith/task-tool.git
git@gitee.com:renith/task-tool.git
renith
task-tool
task-tool接口调用统计工具
master

搜索帮助