# Ignore Spring Boot MVC endpoint and switch to @CaptureTransaction

**URL:** <https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948>\
**Category:** APM\
**Tags:** java\
**Created:** [November 10, 2020, 4:23pm UTC](https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948 "2020-11-10T16:23:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecostanzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ecostanzi/32/78773_2.png) [@ecostanzi](https://discuss.elastic.co/u/ecostanzi)\
**Post date:** [November 10, 2020, 4:23pm UTC](https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948/1 "2020-11-10T16:23:48Z")

</div>

**Kibana version** :  
7.4

**Elasticsearch version** :

**APM Server version** :  
7.4

**APM Agent language and version** :  
1.18.1

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

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

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

My APM instance is correctly working with Spring Boot server in production. Every controller method call is traced. But I need a different behaviour for some HTTP invocations.

For some of my spring mvc controllers, even if the HTTP call is the same, I need 2 distict transactions. I added the @CaptureTransaction annotations inside the business code but I don't understand how to disable the tracing for the controllers.

**Steps to reproduce** :  
I tried to:

1. add `classes_excluded_from_instrumentation=my.contoller.package.*` but doesn't work becaus the transaction (I guess) is started earlier by the agent
2. `transaction_ignore_urls=/controller/path` but again, i still see the traced controller methods
3. add `disable_instrumentations=spring-mvc` (disables all tracing, but doesn't open new transactions when invoking annotated methods.

---

<div class="post-metadata">

**Author:** ![ecostanzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ecostanzi/32/78773_2.png) [@ecostanzi](https://discuss.elastic.co/u/ecostanzi)\
**Post date:** [November 10, 2020, 4:56pm UTC](https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948/2 "2020-11-10T16:56:04Z")

</div>

I managed to solve, the working solution is using `transaction_ignore_urls` and add the @traced annotation in the java code.

I mispelled the configuration name.

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [November 12, 2020, 8:52am UTC](https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948/3 "2020-11-12T08:52:31Z")

</div>

Hi @ecostanzi ! That's good to hear that you found a suitable solution.

Alternatively, you could have used the [public API](https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html) to change transaction name at runtime, which could be a bit more flexible and reliable than relying only on configuration.

As your application evolves, you'll likely have to keep this configuration up to date, and there might be things that will be ignored until you notice that they are missing. With explicit calls to the API, in the worst case some transactions won't be named as you expect, but won't be ignored.

---

<div class="post-metadata">

**Author:** ![ecostanzi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ecostanzi/32/78773_2.png) [@ecostanzi](https://discuss.elastic.co/u/ecostanzi)\
**Post date:** [November 30, 2020, 4:27pm UTC](https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948/4 "2020-11-30T16:27:03Z")

</div>

Thank you @Sylvain_Juge, your alternative is much better and flexbile.

---

<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 21, 2020, 12:27pm UTC](https://discuss.elastic.co/t/ignore-spring-boot-mvc-endpoint-and-switch-to-capturetransaction/254948/5 "2020-12-21T12:27:06Z")

</div>

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