# Abandon/Cancel a transaction

**URL:** <https://discuss.elastic.co/t/abandon-cancel-a-transaction/263911>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [February 10, 2021, 5:32pm UTC](https://discuss.elastic.co/t/abandon-cancel-a-transaction/263911 "2021-02-10T17:32:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![freeranger](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@freeranger](https://discuss.elastic.co/u/freeranger)\
**Post date:** [February 10, 2021, 5:32pm UTC](https://discuss.elastic.co/t/abandon-cancel-a-transaction/263911/1 "2021-02-10T17:32:09Z")

</div>

Hi

We are capturing metrics on queue throughput in one of our apps.  
There are often periods of no activity followed by periods of intense activity.  
In the quiet periods with nothing going on, we want to abandon the transaction we have started (we don't know until after it is stated if there was anything to dequeue).

How can we abandon a transaction we started - is it simply enough to not call End() and let the instance go out of scope or is there something more specific to do?

Thanks

---

<div class="post-metadata">

**Author:** ![GregKalapos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gregkalapos/32/37205_2.png) [@GregKalapos](https://discuss.elastic.co/u/GregKalapos)\
**Post date:** [February 24, 2021, 11:36am UTC](https://discuss.elastic.co/t/abandon-cancel-a-transaction/263911/2 "2021-02-24T11:36:18Z")

</div>

I think the best approach would be to use the [Filter API](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html#filter-api). The filter is called for each transaction and if you return `null` for a specific transaction, then it'll simply be ignored and not sent to the APM Server.

---

<div class="post-metadata">

**Author:** ![freeranger](https://avatars.discourse-cdn.com/v4/letter/f/4bbf92/32.png) [@freeranger](https://discuss.elastic.co/u/freeranger)\
**Post date:** [February 24, 2021, 12:42pm UTC](https://discuss.elastic.co/t/abandon-cancel-a-transaction/263911/3 "2021-02-24T12:42:51Z")

</div>

Ok thanks Greg - that is the route we ended up pursuing - didn't know if there was a better way or not

---

<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:** [March 17, 2021, 8:43am UTC](https://discuss.elastic.co/t/abandon-cancel-a-transaction/263911/4 "2021-03-17T08:43:01Z")

</div>

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