运行 时间跟踪方法执行 - spring-cloud-sleuth 提供

Run time tracing method execution - spring-cloud-sleuth provides

spring-cloud-sleuth 提供了使用 @NewSpan

跟踪方法执行的方法

由于是注解,不可能在项目的所有方法上都加注解。

此外,在生产环境中,一旦发现执行延迟,我们只需要跟踪方法执行时间。

有没有什么方法可以在 运行 时间启用对方法调用的跟踪而无需重新启动应用程序?

这种方法没有任何现成的方法。不过,您可以做的是注册您自己的 SpanReporter 实现。在该实现中,您可以检索 Span 的持续时间,然后根据其值将其发送或不发送给 Zipkin(或对其执行其他操作)。