# How to instrument java server side to trace out the method calls used when an api call takes place?

**URL:** <https://discuss.elastic.co/t/how-to-instrument-java-server-side-to-trace-out-the-method-calls-used-when-an-api-call-takes-place/187271>\
**Category:** APM\
**Tags:** java\
**Created:** [June 25, 2019, 8:56am UTC](https://discuss.elastic.co/t/how-to-instrument-java-server-side-to-trace-out-the-method-calls-used-when-an-api-call-takes-place/187271 "2019-06-25T08:56:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farisk](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@farisk](https://discuss.elastic.co/u/farisk)\
**Post date:** [June 25, 2019, 8:56am UTC](https://discuss.elastic.co/t/how-to-instrument-java-server-side-to-trace-out-the-method-calls-used-when-an-api-call-takes-place/187271/1 "2019-06-25T08:56:21Z")

</div>

I want to know how to use the java agent in instrumenting a tom cat server to trace out all the method names invoked while calling an API.  
I don't want the database operation stack , i want all the method names of the API which passes through when an API is called.  
Please do tell me a solution to fix this problem.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [June 25, 2019, 9:09am UTC](https://discuss.elastic.co/t/how-to-instrument-java-server-side-to-trace-out-the-method-calls-used-when-an-api-call-takes-place/187271/2 "2019-06-25T09:09:41Z")

</div>

Hi and welcome!

Please go over [optional installation methods](https://www.elastic.co/guide/en/apm/agent/java/current/setup.html).  
In order to trace arbitrary methods, you can use the [`trace_methods` configuration](https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-trace-methods).  
In order to trace any of your methods, you can use [our public API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html).

I hope this helps.  
Good luck!

---

<div class="post-metadata">

**Author:** ![farisk](https://avatars.discourse-cdn.com/v4/letter/f/f07891/32.png) [@farisk](https://discuss.elastic.co/u/farisk)\
**Post date:** [June 27, 2019, 5:56am UTC](https://discuss.elastic.co/t/how-to-instrument-java-server-side-to-trace-out-the-method-calls-used-when-an-api-call-takes-place/187271/3 "2019-06-27T05:56:21Z")

</div>

Thanks, Now its working fine.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 18, 2019, 1:56am UTC](https://discuss.elastic.co/t/how-to-instrument-java-server-side-to-trace-out-the-method-calls-used-when-an-api-call-takes-place/187271/4 "2019-07-18T01:56:27Z")

</div>

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