Tracing

从 5 版本开始,Spring Batch 通过 Micrometer 的 Observation API 提供追踪。默认情况下,在使用 @EnableBatchProcessing 时启用追踪。Spring Batch 会为每次作业执行创建一条跟踪,为每个步骤执行创建一个小段。

As of version 5, Spring Batch provides tracing through Micrometer’s Observation API. By default, tracing is enabled when using @EnableBatchProcessing. Spring Batch will create a trace for each job execution and a span for each step execution.

如果您不使用 EnableBatchProcessing,则需要在您的应用程序上下文中注册一个 BatchObservabilityBeanPostProcessor,这将自动在您的作业和步骤 Bean 中设置 Micrometer 的观察能力。

If you do not use EnableBatchProcessing, you need to register a BatchObservabilityBeanPostProcessor in your application context, which will automatically setup Micrometer’s observability in your jobs and steps beans.