Follow Up on: Support scheduled tasks #418
See original GitHub issueIs your feature request related to a problem? Please describe. APM Server: 6.8.0 APM agent: 1.7.0 In elastic/apm-agent-java#418 support for the @Scheduled Annotations was added to the agent to create transactions when a scheduled task is being run. As we needed more flexibility we did not use the @Scheduled annotations and used org.springframework.scheduling.quartz.QuartzJobBean:
public class MyJob extends QuartzJobBean {
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
doJobWork();//<--Job is implemented here
}
}
The configuration is done in the Spring XML config:
<bean id="detailJob1" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
<property name="jobClass" value="com.mycompany.MyJob "/>
<property name="name" value="Job1" />
</bean>
<bean id="triggerJob1" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
<property name="jobDetail" ref="detailJob1"/>
<property name="repeatInterval" value="60000"/>
<property name="group" value="my-group-name" />
<property name="startDelay" value="2500"/>
</bean>
<bean id="scheduler" class="rg.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false">
<property name="startupDelay" value="30" />
<property name="triggers" >
<list>
<ref bean="triggerJob1"/>
</list>
</property>
</bean>
This seems to be not yet(1.7.0) supported.
Describe the solution you’d like
It would be great if you could recognise calls to classes implementing org.quartz.Job (org.springframework.scheduling.quartz.QuartzJobBean implements that) and create a Transaction for each call. The transaction name should be the combination of group name and job name which can be read using context.getJobDetail().getKey().toString()
.
Describe alternatives you’ve considered Currently, we are creating transactions using the public API.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
it works :+1
Ahhh…, just handled that, didn’t merge yet though. Can you merge #688?