# APM agent for Elasticsearch

**URL:** https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995
**Category:** APM
**Created:** [July 24, 2019, 9:45am UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995 "2019-07-24T09:45:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)
#### Post date: [July 24, 2019, 9:45am UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995/1 "2019-07-24T09:45:58Z")

</div>

Hi all,  
I would like to know, is there a way to think about APM agent applied directly on Elasticsearch? I mean, to monitor the single transaction starting from the first step (Elasticsearch is contacted to receive a document), should I use the `xpack.monitoring` or is there something different?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [July 24, 2019, 2:56pm UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995/2 "2019-07-24T14:56:44Z")

</div>

Hi Roger thanks for trying out Elastic APM

I'm a little unclear on your question perhaps you can help clarify

Do you want a monitor a whole distributed trace from say the web browser to your application to access the document from Elasticsearch and see that entire trace from web browser to example Java service to Elasticsearch and back?

Or

Are you trying to monitor the internals of Elasticsearch once that search request reaches Elasticsearch?

---

<div class="post-metadata">

### Author: ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)
#### Post date: [July 25, 2019, 11:43am UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995/3 "2019-07-25T11:43:04Z")

</div>

hi @stephenb, my initial idea was the second one. I was thinking about the internals of Elasticsearch getting, for instance, the time of every action (search, fetch and so on). as I said, I know sure if APM should be considered the correct tool.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [July 25, 2019, 10:17pm UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995/4 "2019-07-25T22:17:19Z")

</div>

I am a little curious what you are trying to accomplish do you have a real use case / real performance issue? or is this just for experiment / for your own education.

Typically you wouldn’t run the APM Agent on Elasticsearch itself to monitor Elasticsearch performance. (I am not sure how viable that would be, I would need to look further, there would be some challenges I suspect due to distributed nature with TCP protocols)

In general to monitor Elasticsearch search and index performance teams could use one or more of the following along with other techniques

Elasticsearch Monitoring: Query Per Second, Average Query Latency etc… Host Metrics, Logs etc.

[https://www.elastic.co/guide/en/elastic-stack-overview/current/xpack-monitoring.html](https://www.elastic.co/guide/en/elastic-stack-overview/current/xpack-monitoring.html)

Query Profile, Thread Pools, Hot Nodes,

[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/search-profile.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/search-profile.html)

[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cat-thread-pool.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cat-thread-pool.html)

[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cluster-nodes-hot-threads.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cluster-nodes-hot-threads.html)

[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cat-pending-tasks.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/cat-pending-tasks.html)

Elasticsearch Slow Logs

[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/index-modules-slowlog.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/index-modules-slowlog.html)

---

<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: [July 28, 2019, 4:29am UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995/5 "2019-07-28T04:29:08Z")

</div>

@rschirin adding to @stephenb references, all Elastic APM agents (besides the .NET agent which is still in beta) provide instrumentation to the corresponding Elasticsearch clients. Is there any information/visibility you are missing by using those or the Elasticsearch monitoring options provided above?

We are thinking on a way to add dedicated instrumentation to Elasticsearch, but we are more thinking about how it can assist us to debug issues, rather than provide more visibility to end users.

---

<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: [August 18, 2019, 12:29am UTC](https://discuss.elastic.co/t/apm-agent-for-elasticsearch/191995/6 "2019-08-18T00:29:14Z")

</div>

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