Giter Site home page Giter Site logo

ezprofiler's Introduction

ezprofiler

统计Controller的方法执行时间

使用方式

  1. 添加依赖
<dependency>
  <groupId>com.github.xjs</groupId>
  <artifactId>ezprofiler-spring-boot-starter</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>
  1. 添加配置
@EnableProfiler
@Configuration
public class EzProfilerConfigure {
}

3.项目启动以后,访问浏览器 http://localhost:8080/profiler , 输出结果类似:

{
	"DemoController": [{
		"method": "hello",//方法名
		"uri": "/hello",//访问url
		"invokeCount": 4,//调用的总次数
		"okCount": 4,//成功的次数
		"errorCount": 0,//错误的次数
		"minMills": 2,//最小时间
		"maxMills": 33,//最大时间
		"avgMills": 6,//平均时间
		"todayCount": 4,//今天的调用次数
		"todayOkCount": 4,//今天成功的次数
		"todayErrorCount": 0,//今天失败的次数
		"todayMinMills": 2,//今天最小时间
		"todayMaxMills": 33,//今天最大时间
		"todayAvgMills": 6,//今天平均时间
		"lastMills": 3,//上次调用花费的时间
		"lastInvokeTime": 1523533964865//上次调用时间点
	},]
}

其他配置

  1. 默认会统计所有Controller的所有方法,可以在不想被统计的Controller类或者方法上添加@Profiler(false)注解,方法的优先级高于类的优先级
@GetMapping("/world")
@Profiler(false)
public String world() {
  return "world";
}
  1. 默认会给统计接口加上权限验证,默认的用户名:ezprofiler-admin,密码:ezprofiler-admin,可以自定义:
ezprofiler.enableBasic=true
ezprofiler.username=xjs
ezprofiler.password=123456
  1. 默认的profiler的访问路径是/profiler,可以自定义:
ezprofiler.url=/my/profiler

4.可以自定义要扫描的controller的base package,默认是com

ezprofiler.basepackage=com.github.xjs.controller

ezprofiler's People

Contributors

xjs1919 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.