# APM Transaction and Error JSON

**URL:** <https://discuss.elastic.co/t/apm-transaction-and-error-json/206716>\
**Category:** APM\
**Tags:** python\
**Created:** [November 6, 2019, 3:48am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716 "2019-11-06T03:48:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SheetalRIL](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SheetalRIL](https://discuss.elastic.co/u/SheetalRIL)\
**Post date:** [November 6, 2019, 3:48am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716/1 "2019-11-06T03:48:59Z")

</div>

Hi Team,

We are using ELK 6.8.4 and trying to add custom tags in APM JSONs.  
I have a query related to transaction and error JSONs.  
When my REST API is successful, it generates on transction JSON which is correct but when the response is failed, it is generating only error JSON. My understanding is irrespective of the response of REST API, it should generate transaction JSON.  
Please correct my understanding as we are creating custom dashboard using APM's transaction JSONs.

Thanks,  
Sheetal

---

<div class="post-metadata">

**Author:** ![simitt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simitt/32/106406_2.png) [@simitt](https://discuss.elastic.co/u/simitt)\
**Post date:** [November 6, 2019, 11:08am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716/2 "2019-11-06T11:08:54Z")

</div>

Could you share which APM agent and version you are using?

---

<div class="post-metadata">

**Author:** ![SheetalRIL](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SheetalRIL](https://discuss.elastic.co/u/SheetalRIL)\
**Post date:** [November 6, 2019, 11:32am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716/3 "2019-11-06T11:32:38Z")

</div>

Hi ,  
We are using APM 6.8.1 version with APM Python Agent.

Thanks,  
Sheetal

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [November 12, 2019, 10:27am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716/4 "2019-11-12T10:27:02Z")

</div>

Hi @SheetalRIL

do you happen to use Flask for your REST API? I just found a bug in our Flask integration, which results in exactly this behavior. Basically, we listen to the `flask.signals.request_finished` signal to end the transaction, but it turns out that Flask doesn't send that signal if an unhandled error occurs during the request.

I've opened an issue to track this here: [https://github.com/elastic/apm-agent-python/issues/629](https://github.com/elastic/apm-agent-python/issues/629)

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [November 15, 2019, 8:43am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716/5 "2019-11-15T08:43:01Z")

</div>

@SheetalRIL we just released a fix for the bug I described above, it's in 5.3.0 of the agent. Can you give that a try?

---

<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:** [December 6, 2019, 4:43am UTC](https://discuss.elastic.co/t/apm-transaction-and-error-json/206716/6 "2019-12-06T04:43:07Z")

</div>

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