Я придумал следующий класс конфигурации:
Код: Выделить всё
@Configuration
class MicrometerConfig implements AsyncConfigurer {
public static Executor executor() {
return ContextExecutorService.wrap(ForkJoinPool.commonPool(), contextSnapshotFactory::captureAll);
}
private static final ContextSnapshotFactory contextSnapshotFactory = ContextSnapshotFactory.builder()
.build();
@Override
public Executor getAsyncExecutor() {
return ContextExecutorService.wrap(Executors.newCachedThreadPool(), contextSnapshotFactory::captureAll);
}
}
Я также пытался вручную добавить новый диапазон в форму моего асинхронного исполнителя
Код: Выделить всё
@Override
public Executor getAsyncExecutor() {
Span span = tracer.nextSpan();
span.start();
try (Tracer.SpanInScope ignored = tracer.withSpan(span)) {
log.info("NEWSPAN");
return ContextExecutorService.wrap(Executors.newCachedThreadPool(), contextSnapshotFactory::captureAll);
}
}
Подробнее здесь: https://stackoverflow.com/questions/782 ... n-on-async
Мобильная версия