# Monitoring of private method and other method that are not directly associated to an HTTP endpoint

**URL:** <https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348>\
**Category:** APM\
**Created:** [September 5, 2018, 9:01am UTC](https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348 "2018-09-05T09:01:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbo/32/29972_2.png) [@cbo](https://discuss.elastic.co/u/cbo)\
**Post date:** [September 5, 2018, 9:01am UTC](https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348/1 "2018-09-05T09:01:21Z")

</div>

Hi,

First thank you for your amazing work on all your products.

I've configured an APM server (6.4.0) and deployed the JAVA agent (0.6.2) on some of our apps.  
Everythings runs good, I have the stats on our HTTP endpoint (Controller).

My question is : if I want a more detailled monitoring (for example, private method or method in Service class), should I use the API to create custom Transaction or is there going to be the functionnality in a future release?

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [September 6, 2018, 1:07pm UTC](https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348/2 "2018-09-06T13:07:56Z")

</div>

If the method you want to monitor is already part of a transaction, you can use the API to get the current transaction and add another span to it.

> [@cbo](#):
>
> or is there going to be the functionnality in a future release?

We have thought about adding an annotation-based approach to that, but we don't have concrete plans. If you have any suggestions, feel free to voice them 🙂

---

<div class="post-metadata">

**Author:** ![cbo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbo/32/29972_2.png) [@cbo](https://discuss.elastic.co/u/cbo)\
**Post date:** [September 7, 2018, 3:18pm UTC](https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348/3 "2018-09-07T15:18:18Z")

</div>

Thanks for your reply!

An annotation-based approach to define custom span? That's sound great. I think we're going to implement something like that to see how it works 🙂

I don't know how much infos is avaiable to the java agent, but I was thinking about having a sort of treeview to see the call hierarchy. JProfiler for example give this kind of infos when you ask it to monitor CPU usage :

![image](https://us1.discourse-cdn.com/elastic/original/3X/0/1/01c3196a9c5f8f2b1b42112582e4a46a916bf643.png)

I don't know about the feasibility and the ressource consumption though. 🙃

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [September 10, 2018, 2:29pm UTC](https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348/4 "2018-09-10T14:29:01Z")

</div>

As the Elastic APM agent is primarily designed to run with very low overhead in production, I don't think it would be a good idea to create a span for every method call in the application.

But we might integrate with a sampling-based profiler in the future.

---

<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:** [October 1, 2018, 10:29am UTC](https://discuss.elastic.co/t/monitoring-of-private-method-and-other-method-that-are-not-directly-associated-to-an-http-endpoint/147348/5 "2018-10-01T10:29:02Z")

</div>

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