# Elasticsearch Rest High Level Client is not traced

**URL:** <https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223>\
**Category:** APM\
**Tags:** java\
**Created:** [October 11, 2019, 11:18am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223 "2019-10-11T11:18:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Svetlana\_Nikitina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/svetlana_nikitina/32/46276_2.png) [@Svetlana\_Nikitina](https://discuss.elastic.co/u/Svetlana_Nikitina)\
**Post date:** [October 11, 2019, 11:18am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223/1 "2019-10-11T11:18:32Z")

</div>

**Kibana version** : 6.8.0

**Elasticsearch version** : 6.8.0

**APM Server version** : 6.8.0

**APM Agent language and version** : JAVA apm-agent-attach:1.10.0, apm-agent-api:1.10.0

**Browser version** : Chrome 77.0.3865.90

**Java version** : openjdk:11

**Description of the problem including expected versus actual behavior** :  
We are running a spring boot application (`2.1.4.RELEASE`) with rest api, which makes queries to Elasticsearch (`7.3.0`) using java high level client:

```
 <dependency>
        <groupId>org.elasticsearch.client</groupId>
        <artifactId>elasticsearch-rest-high-level-client</artifactId>
        <version>7.3.0</version>
    </dependency>

```

Though it is defined in the docs, that tracing of ES rest client comes out of the box, we cannot see any traces for it

We can see:

- traces of the initial rest call
- traces of the calls to downstream systems
- traces of the `@CaptureSpan` annotated methods

Is elasticsearch-rest-high-level-client not supported by APM out of the box or we are missing smth.

we start APM upon spring application startup using:  
`ElasticApmAttacher.attach();`

our config is:

```
active=true
service_name= {app-name}
server_urls= {apm-host}
transaction_sample_rate=0.5
application_packages=com.app
log_level=DEBUG

```

I something missing in our set up or there is no such support provided?

---

<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:** [October 15, 2019, 7:08am UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223/2 "2019-10-15T07:08:28Z")

</div>

Hi Svetlana and welcome to the forum 🙂

I couldn't reproduce this by adjusting our integration tests to use the 7.3 client (meaning- it is properly traced using [the 7.1 integration test](https://github.com/elastic/apm-agent-java/blob/master/apm-agent-plugins/apm-es-restclient-plugin/apm-es-restclient-plugin-7_1/src/test/java/co/elastic/apm/agent/es/restclient/v7_1/ElasticsearchRestClientInstrumentationIT.java)).

Please set [`log_level`](https://www.elastic.co/guide/en/apm/agent/java/current/config-logging.html#config-log-level) to `DEBUG` and upload the logs.

A few questions:

1. Are these queries being performed synchronously as part of the request handling thread, or is there some async forking of some kind (eg usage of `BlockingQueue`) making the queried being done by another thread?
2. Which APIs are you using? If you can send specific code snippet of a query not being traced, that would be useful.

Regardless, do you get your "initial rest calls" and "calls to downstream systems" collected as single or separate traces? If you are using [supported technologies](https://www.elastic.co/guide/en/apm/agent/java/current/supported-technologies-details.html), then [our distributed tracing mechanism](https://www.elastic.co/guide/en/apm/get-started/current/distributed-tracing.html) should correlate them.

---

<div class="post-metadata">

**Author:** ![Svetlana\_Nikitina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/svetlana_nikitina/32/46276_2.png) [@Svetlana\_Nikitina](https://discuss.elastic.co/u/Svetlana_Nikitina)\
**Post date:** [October 16, 2019, 4:44pm UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223/3 "2019-10-16T16:44:45Z")

</div>

Hi Eyal\_Koren,  
Thank you for your help  
It has turned out, that my colleauges shaded high level rest client jar to be able to connect to both ES5 and ES7 instances, which we have  
since the package of ES7 was shaded, APM couldn't see it  
but it worked out with the normal (non-shaded) jar

---

<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:** [October 16, 2019, 5:04pm UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223/4 "2019-10-16T17:04:43Z")

</div>

Glad to hear 🙂.  
Thanks for the feedback!

---

<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:** [November 6, 2019, 1:04pm UTC](https://discuss.elastic.co/t/elasticsearch-rest-high-level-client-is-not-traced/203223/5 "2019-11-06T13:04:53Z")

</div>

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