I have a Spring Boot application using APM Agent 1.36.0.
A request submits a job to an executor and returns immediately. The relevant code looks like:
private ExecutorService executor = Executors.newSingleThreadExecutor();
public void scheduleJob(Job details) {
executor.submit(() -> doProcessing(details));
}
@CaptureTransaction(type = "scheduled")
protected void doProcessing(Job details) {
// stuff
}
However, APM collects the spans generated during doProcessing
under the original request transaction.
Is the transaction state supposed to be maintained across threads like this, and is there a way to (possibly selectively) stop it?
Config:
use_path_as_transaction_name=true
disable_instrumentations=experimental,micrometer
enable_log_correlation=true
span_stack_trace_min_duration=-1ms
cloud_provider=none
capture_headers=true
enabled=true
transaction_ignore_user_agents=Elastic-Heartbeat/*,Zabbix/*,*OpenVAS-VT*,*Nessus*,*MSIE 8.0*
central_config=false
environment=staging
application_packages=com.example.myapp
use_elastic_traceparent_header=false