# Finding errors related to transactions

**URL:** https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667
**Category:** APM
**Tags:** java
**Created:** [May 21, 2020, 5:20am UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667 "2020-05-21T05:20:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![krishnavk](https://avatars.discourse-cdn.com/v4/letter/k/8baadc/32.png) [@krishnavk](https://discuss.elastic.co/u/krishnavk)
#### Post date: [May 21, 2020, 5:20am UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/1 "2020-05-21T05:20:13Z")

</div>

**Elasticsearch version** :  
6.8.4  
**APM Server version** :  
7.6.0  
**APM Agent language and version** :  
Java agent - 1.15

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
Download package

**Fresh install or upgraded from other version?**  
Upgraded

Currently, we can link the error document to a particular transaction with the `transaction.id` field in the error document. However, I do not see any way to link the error from the transaction document.  
What we would like to achieve is a query which will get us the error (or even acknowledge that there was an error) from the transaction index. Something similar to the `span_count` field in the transaction document.

Is there a way we can achieve this?

---

<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: [May 21, 2020, 9:54am UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/2 "2020-05-21T09:54:05Z")

</div>

Thanks for the feedback!  
Please describe you use case in more details (what question you want to get answered).  
In case you are not aware, there is a `transaction.result` field, that doesn't answer exactly what you are asking, but may be useful if you are looking for transactions ending erroneously.

---

<div class="post-metadata">

### Author: ![krishnavk](https://avatars.discourse-cdn.com/v4/letter/k/8baadc/32.png) [@krishnavk](https://discuss.elastic.co/u/krishnavk)
#### Post date: [May 21, 2020, 1:30pm UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/3 "2020-05-21T13:30:04Z")

</div>

Thanks for your reply, Eyal!

The exceptions thrown in our application are not specific to the status code (which is essentially the data in `transaction.result`). We find that not all erroneous status codes result in an error event.  
What we would like to do is get the number of errors grouped by the transaction name.  
A single query that will get us the number of errors where `transaction.name == *`  
I am aware that this can be achieved with a two step query, but just confirming that there isn't a simpler way to do this.

---

<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: [May 21, 2020, 2:34pm UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/4 "2020-05-21T14:34:43Z")

</div>

> [@krishnavk](#):
>
> We find that not all erroneous status codes result in an error event

It would be interesting if you could point us to exact scenarios where that is the case.

> [@krishnavk](#):
>
> I am aware that this can be achieved with a two step query, but just confirming that there isn't a simpler way to do this.

Unfortunately, given our schema and what you need, I believe this will be the way to go.

---

<div class="post-metadata">

### Author: ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)
#### Post date: [May 25, 2020, 9:28am UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/5 "2020-05-25T09:28:08Z")

</div>

Are you interested in the exact number of errors or would a simple boolean flag at the transaction level be enough for you? Such a flag could indeed be quite useful to calculate the error rate of transactions.

---

<div class="post-metadata">

### Author: ![krishnavk](https://avatars.discourse-cdn.com/v4/letter/k/8baadc/32.png) [@krishnavk](https://discuss.elastic.co/u/krishnavk)
#### Post date: [May 26, 2020, 12:00pm UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/6 "2020-05-26T12:00:26Z")

</div>

Even a simple boolean flag will help quite a bit.  
Is there a way we can contribute to the java and python agent to get this flag?  
Any help in this direction would be great!

---

<div class="post-metadata">

### Author: ![krishnavk](https://avatars.discourse-cdn.com/v4/letter/k/8baadc/32.png) [@krishnavk](https://discuss.elastic.co/u/krishnavk)
#### Post date: [May 26, 2020, 12:03pm UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/7 "2020-05-26T12:03:16Z")

</div>

> [@Eyal\_Koren](#):
>
> It would be interesting if you could point us to exact scenarios where that is the case.

As an example, in a python application, an uncaught syntax error will throw a 500 Internal Server error, which will trigger an error event.  
But in somecases, we catch the exception and return an HTTP Response with 500 status code. In these cases, an error event is not triggered.

---

<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: [June 16, 2020, 8:03am UTC](https://discuss.elastic.co/t/finding-errors-related-to-transactions/233667/8 "2020-06-16T08:03:18Z")

</div>

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