# Trace calls between ES nodes with opentracing

**URL:** <https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509>\
**Category:** Elasticsearch\
**Created:** [May 3, 2019, 9:48am UTC](https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509 "2019-05-03T09:48:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![CanardMoussant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/canardmoussant/32/45421_2.png) [@CanardMoussant](https://discuss.elastic.co/u/CanardMoussant)\
**Post date:** [May 3, 2019, 9:48am UTC](https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509/1 "2019-05-03T09:48:37Z")

</div>

We are using ElasticSearch with cross-cluster search. I was wondering if there was a way to have the trace-id propagated across the various ES nodes targeted to be able to build a flamegraph of the various calls made between nodes. Is there a plugin doing that? We are using the `TransportClient` on our client side with an opentracing library.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 3, 2019, 2:31pm UTC](https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509/2 "2019-05-03T14:31:15Z")

</div>

The [`X-Opaque-Id` header](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/tasks.html#_identifying_running_tasks) seems to be roughly what you are looking for: it is a user-supplied ID that is propagated between nodes as part of a request, and is exposed by the tasks API.

---

<div class="post-metadata">

**Author:** ![CanardMoussant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/canardmoussant/32/45421_2.png) [@CanardMoussant](https://discuss.elastic.co/u/CanardMoussant)\
**Post date:** [May 3, 2019, 3:12pm UTC](https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509/3 "2019-05-03T15:12:24Z")

</div>

Maybe I am not understanding correctly, but this would not build new spans every time the request coming from a given trace would hit an ES node, right?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [May 3, 2019, 3:31pm UTC](https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509/4 "2019-05-03T15:31:38Z")

</div>

The notion of a _task_ in Elasticsearch is pretty much what I think you are calling a span, and yes you get a new one each time a request passes between two nodes (and also often when a request moves from one phase to another within the same node).

Extracting the tasks (i.e. spans) in a usable form is perhaps the hardest part of what you're asking. There doesn't look to be a way to do that, even via a plugin, today.

---

<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:** [May 31, 2019, 3:31pm UTC](https://discuss.elastic.co/t/trace-calls-between-es-nodes-with-opentracing/179509/5 "2019-05-31T15:31:47Z")

</div>

Closed on May 31, 2019, 3:31pm UTC

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