-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-configure ObservationRegistry in ScheduledTaskRegistrar for scheduled tasks observations #36119
Comments
I've got something working in https://github.com/mhalbritter/spring-boot/tree/mh/36119-auto-configure-observationregistry-in-scheduledtaskregistrar-for-scheduled-tasks-observations This removes |
I've upgraded to Java 21 and Spring 3.2, turned on virtual threads and I still can't see |
@Alos does it work without virtual threads? |
@bclozel after some tinkering, it looks like the issue might related to the Micrometer implementation with Spring Cloud GCP and/or the permissions needed to populate spanIds. Thanks for the comment tho :) |
@Alos thanks for letting me know! |
Ahhh I discovered something @bclozel, it looks like @Scheduled(
fixedDelayString = "2",
timeUnit = TimeUnit.SECONDS)
@Async
public void doSomething() throws InterruptedException {
log.info(
"->doSomething thread name: {} Id: {}",
Thread.currentThread().getName(),
Thread.currentThread().threadId());
Thread.sleep(10000);
} Would not have any spanIds. Is the correct way to enable this to create a custom |
I think this is similar to the event listener support for async: https://docs.spring.io/spring-framework/reference/integration/observability.html#observability.application-events |
As of Spring Framework 6.1.0-M2, a new instrumentation observes the execution of
@Scheduled
annotated methods. See spring-projects/spring-framework#29883.To support this feature automatically, Spring Boot should configure the
ObservationRegistry
with aSchedulingConfigurer
. As far as I understand, aSchedulingConfigurer
bean is currently considered as a signal for auto-configuration backoff so we might need to tweak the approach here.The text was updated successfully, but these errors were encountered: