方法
使用Spring Boot Actuator
使用AOP
使用Micrometer和Prometheus(或其他监控系统)集成
使用Util类中的StopWatch或Instant.now()等方法
区别
前三种方法都可以实现一次配置,监控不同接口的运行时长
第四种方法需要再每个需要监控的接口中嵌入相关代码
使用Spring Boot Actuator
使用AOP
使用Micrometer和Prometheus(或其他监控系统)集成
使用Util类中的StopWatch或Instant.now()等方法
前三种方法都可以实现一次配置,监控不同接口的运行时长
第四种方法需要再每个需要监控的接口中嵌入相关代码