# Missing outgoing HTTP Span GO Lang

**URL:** <https://discuss.elastic.co/t/missing-outgoing-http-span-go-lang/272452>\
**Category:** APM\
**Tags:** go\
**Created:** [May 7, 2021, 9:57pm UTC](https://discuss.elastic.co/t/missing-outgoing-http-span-go-lang/272452 "2021-05-07T21:57:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianmcgraw](https://avatars.discourse-cdn.com/v4/letter/i/57b2e6/32.png) [@ianmcgraw](https://discuss.elastic.co/u/ianmcgraw)\
**Post date:** [May 7, 2021, 9:57pm UTC](https://discuss.elastic.co/t/missing-outgoing-http-span-go-lang/272452/1 "2021-05-07T21:57:33Z")

</div>

**Kibana version** : v 7.9.2 (elastic cloud)

**Elasticsearch version** : v 7.9.2 (elastic cloud)

**APM Server version** : v 7.9.2 (elastic cloud)

**APM Agent language and version** : Golang

| | [go.elastic.co/apm/module/apmgorilla](http://go.elastic.co/apm/module/apmgorilla) v1.10.1-0.20210330103029-f759010eb3b4 |
| --- | --- |
| | [go.elastic.co/apm/module/apmhttp](http://go.elastic.co/apm/module/apmhttp) v1.11.0 |

Hi,

I recently instrumented our Golang services with the ElasticAPM go agent. So for I have setup multiple services that successfully trace outgoing http requests to downstream services. Unfortunately, our `arthurai-metric-service` seems to be missing traces in the parent service's transactions. Here is a screenshot of the parent trace:

 ![Screen Shot 2021-05-07 at 5.48.18 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/9/19efb5ac455e937641de066f3a6c558003530797.png)

There should be another span for an outgoing http call before the POST call shown to `arthurai-v3-schema-service` in this trace. Oddly, the downstream service registers the trace and even has a link to this parent trace, but for some reason, it doesn't show in this parent trace. Here is a screenshot of the child trace:

 ![Screen Shot 2021-05-07 at 5.50.19 PM](https://us1.discourse-cdn.com/elastic/original/3X/4/d/4d1da24d0d4c66b193b636c88149307a5150ca96.png)

If I click "view full trace" in this child trace, it brings me to the correct parent trace above, but for some reason this one is not linked like the other services are.

Additionally, If I look at the metadata of the downstream service's trace:

 ![Screen Shot 2021-05-07 at 5.50.41 PM](https://us1.discourse-cdn.com/elastic/original/3X/c/e/ceb4003471e3a1491b309f79b5bf10c218f4e91c.png)

I see the same `trace.id` that I see in the other downstream call to `arthurai-schema-service`'s trace:

 ![Screen Shot 2021-05-07 at 5.51.16 PM](https://us1.discourse-cdn.com/elastic/original/3X/6/9/69af27a5ddd6f472cb1cae7e2b657292df83d0db.png)

It seems like the trace context is correctly passing to the downstream service. Is there something I'm missing here that should link these together? Thanks for the help!

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [May 10, 2021, 1:25am UTC](https://discuss.elastic.co/t/missing-outgoing-http-span-go-lang/272452/2 "2021-05-10T01:25:12Z")

</div>

Welcome to the forum @ianmcgraw!

One possible explanation is that the response body isn't being closed or fully consumed in the client -- either of these is what marks the end of the client HTTP span. Can you please check that first?

If it's not that, then we'll need to grab some debug logs for the agent: [Troubleshooting | APM Go Agent Reference [1.x] | Elastic](https://www.elastic.co/guide/en/apm/agent/go/current/troubleshooting.html#agent-logging) to see if the server is rejecting any events.

Finally, it would also be worth taking a look at the documents in Discover to rule out any bugs in the APM UI, unlikely as that may be. Filter on `trace.id` and see if there's a document with `span.name` set to `POST arthurai-v3-metric-service`.

---

<div class="post-metadata">

**Author:** ![ianmcgraw](https://avatars.discourse-cdn.com/v4/letter/i/57b2e6/32.png) [@ianmcgraw](https://discuss.elastic.co/u/ianmcgraw)\
**Post date:** [May 10, 2021, 2:48pm UTC](https://discuss.elastic.co/t/missing-outgoing-http-span-go-lang/272452/3 "2021-05-10T14:48:21Z")

</div>

Ah yes! We were missing the call to `Body.Close()`. No wonder I couldn't find where the span ended. Thanks so much!

---

<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, 2021, 10:48am UTC](https://discuss.elastic.co/t/missing-outgoing-http-span-go-lang/272452/4 "2021-05-31T10:48:32Z")

</div>

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