APM Java Agent on Tomcat is not tracing method invocation from quartz threads on app

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

Kibana version: 7.0.0

Elasticsearch version: 7.0.0

APM Server version: 7.0.1

APM Agent language and version: JAVA 1.7.0
Tomcat v8.5.30

Fresh install or upgraded from other version?
Fresh Install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.
Tomcat setenv.sh:
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/apm/elastic-apm-agent-1.7.0.jar"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.service_name=frm-service-des"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.application_packages=com.example"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.server_urls=http://localhost:8200"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.environment=des"
export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm**.trace_methods**=com.example.app.service.job.*Job#execute"

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
Jobs are executed through Quartz threads, not tomcat threads. In kibana, I expected to also see jobs transactions, however I only see HTTP transactions (index_jsp#doGet).

Steps to reproduce:

  1. On tomcat, deploy a war application with Quartz jobs and try to trace them.

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):
Jobs execution is viewed on logs:
INFO 2019-07-05 13:30:00,004 [scheduler_Worker-2] com.example.app.service.job.IntegrationJob - Job ** Integration_Job_Detail ** fired @ Fri Jul 05 13:30:00 CEST 2019

However no trace appears on APM.

Found out how to debug agent and activated it. It is correctly getting traces. So navigated a little bit on Kibana and found out that transactions exist, but are not shown:

Kibana problem?

Seen the filter on first image by type! Really confusing behavior and cannot select all. Anyway, problem "solved".

Welcome to the forum and thanks for your feedback!

No reason to do this- put a REAL root package of your application.

Regarding Quartz- guess what: @Wolfram_Haussig just created a pull request implementing a plugin for capturing Quartz jobs out of the box!! If you can try it out and give us feedback- that will be awesome! You can download this snapshot build and try it out (without the -Delastic.apm.trace_methods=com.example.app.service.job.*Job#execute configuration).

Thanks,
Eyal.

@inakipaz As Eyal said I implemented Quartz support last week as we too are using Quartz and would like to see the Jobs in APM. I would appreciate any feedback on the implementation.

@Eyal_Koren I used com.example to hide some data. It actually is the real package on the implementation.

@Wolfram_Haussig Just downloaded the snapshot and will test it on our dev environment. Will be back to comment on your github thread.

@Wolfram_Haussig Just deployed and updated one tomcat with quartz. Works as expected. Stopped using trace_methods.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.