【问题标题】:Any way to monitor a Java application's Function Flow?有什么方法可以监控 Java 应用程序的功能流?
【发布时间】:2019-03-08 06:41:50
【问题描述】:

在我的新任务中,我需要了解一个中级 Java 应用程序。为了更快地理解流程,我有一个想法,如果我能在运行时看到正在调用的函数,最终响应的是哪个函数,那么我真的可以在脑海中得到整个地图。

我使用过诸如 AppDynamics 之类的工具,它可以告诉延迟/数据库调用等。但我所关注的是可以告诉我运行时流程的东西。 喜欢,
Controller.getStudent() -> Service.getStudent() -> Repository.getStudent() -> ....

我想知道是否有任何工具/技术。就像在调试模式下记录堆栈跟踪一样。我可以想象一个工具在做Thread.currentThread().getStackTrace()。有人对如何做到这一点有一些想法吗? (我使用的是 Springboot 和 Jboss)

编辑:我并没有真正关注日志记录、调试等。我觉得可能有一些东西可以告诉我们正在执行哪些功能。并确定是否有任何限制。

【问题讨论】:

  • 在您的方法中添加日志记录,并遵循日志
  • 使用 Spring-boot,您可以添加一个方面以在被调用的方法上自动添加跟踪

标签: java performance monitoring execution


【解决方案1】:
@Aspect
@Component
public class FunctionTraceAspect {
    @Before("execution(* some.package.*.*.*(..))")
    public void appendUserContext(JoinPoint joinPoint) {
        System.out.println("TRACE: " + joinPoint.getSignature());
   }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-28
    • 2022-01-13
    • 2011-01-07
    • 1970-01-01
    • 2012-05-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多