# Remove spring DispatcherServlet from transactions

**URL:** <https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147>\
**Category:** APM\
**Tags:** java\
**Created:** [June 24, 2019, 1:51pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147 "2019-06-24T13:51:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [June 24, 2019, 1:51pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/1 "2019-06-24T13:51:14Z")

</div>

Hi,

I have APM setup on a local server, and my agents are installed on some applications that are springboot. Because of this when I look at the transactions page for my app I only see 2 transactions;

DispatcherServlet#doGet  
DispatcherServlet#doPost

And all of the relevent methods that I want to see on the transactions page is nested underneath those.

What I would like is to not show this top level DispatcherServlet on the transactions page, but instead the method that comes after that.

Any help is appreciated,  
Thanks!

---

<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:** [June 25, 2019, 6:04am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/2 "2019-06-25T06:04:39Z")

</div>

Hi and welcome to the forum 🎉

Please provide this additional info:

1. What Spring MVC version are you using?
2. If possible, some sample code of your controllers
3. Agent setup and configuration you use
4. Set [log\_level](https://www.elastic.co/guide/en/apm/agent/java/current/config-logging.html#config-log-level) to DEBUG and upload the log

Thanks,  
Eyal

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [June 25, 2019, 8:45am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/3 "2019-06-25T08:45:53Z")

</div>

Thanks for your response, here are the details

Spring version in use

```
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.4.RELEASE</version>

```

My agent setup is as follows, have been trying different configs to try and get the result I want, but currently have got it set to something basic

java -javaagent:C:\Users\me\Desktop\Elastic\javaagents\my-app-elastic-apm-agent-1.6.1.jar -Delastic.apm.application\_packages=com.my.Services.myService -Delastic.apm.server\_urls=http://localhost:8200 -Delastic.apm.trace\_methods=com.my.Services.myService#\* -Delastic.apm.log\_level=DEBUG -jar myService-1.0.jar

I've put the debug of the agent startup here

....

---

<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:** [June 25, 2019, 9:04am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/4 "2019-06-25T09:04:05Z")

</div>

Can you provide a code sample of you controllers? Which annotations do you use within them?

---

<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:** [June 25, 2019, 9:21am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/5 "2019-06-25T09:21:49Z")

</div>

Also, the log you uploaded is very partial- covers less than 4 seconds

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [June 25, 2019, 11:03am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/6 "2019-06-25T11:03:40Z")

</div>

Here's an example of one of our controllers

```auto

```

---

<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:** [June 25, 2019, 11:18am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/7 "2019-06-25T11:18:52Z")

</div>

Thanks. Can you upload a full debug log?

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [June 25, 2019, 1:13pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/8 "2019-06-25T13:13:44Z")

</div>

Hi,

Sorry yes, I've added debug from agent/server startup and going through to a few minutes after startup

...

---

<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:** [June 25, 2019, 1:23pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/9 "2019-06-25T13:23:07Z")

</div>

Thanks.  
What are the non-sprint annotations?  
If possible, please add your `AbstractResource` as well (and further superclasses if any)- I want to see if there's any inheritance related.

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [June 25, 2019, 2:01pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/10 "2019-06-25T14:01:30Z")

</div>

The abstract class look largely the same

```auto

```

---

<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:** [June 25, 2019, 2:42pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/11 "2019-06-25T14:42:17Z")

</div>

So far I fail to reproduce. In addition, I don't see a reason why it shouldn't work in logs- I see the SpringTransactionNameInstrumentation being applied as expected.

So, few more questions:

1. Does the Abstract resource have class annotations as well?
2. Can you explain what the TagResource inherits from the AbstractResource?
3. What is the Spring MVC version you are using (ie the version from the `spring-mvc-<version>` jar)?

---

<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:** [June 26, 2019, 4:35am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/12 "2019-06-26T04:35:04Z")

</div>

@ethranes Are you using Spring WebFlux?

One option is that the transaction name is set by a different thread than the one creating it.  
Please try out [this snapshot diagnostic build](https://github.com/elastic/support-dev-help/files/3328188/elastic-apm-agent-1.7.1-SNAPSHOT.jar.zip). Set `log_level=TRACE`, make sure it is fully started and make a few requests to reproduce the problem.

I hope this helps finding the issue.  
Thanks.

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [June 26, 2019, 10:20am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/13 "2019-06-26T10:20:29Z")

</div>

abstract methods have the same annotations as the tag class. the tagresource class inherits more simple request mapping from the abstract class such as

@RequestMapping(value = ""  
@RequestMapping(value = "/{id}"

the reason being that multiple classes will use these more common requestmapping, so their shared between a number of resources.

I wasn't able to download that build that you linked, it's linking to a webpage and saying not found.

---

<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:** [June 26, 2019, 12:05pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/14 "2019-06-26T12:05:40Z")

</div>

Please try [this one](https://apm-ci.elastic.co/job/apm-agent-java/job/apm-agent-java-mbp/job/PR-694/1/artifact/src/github.com/elastic/apm-agent-java/elastic-apm-agent/target/elastic-apm-agent-1.7.1-SNAPSHOT.jar) then.

Regarding inheritance- so TagResource's methods inherit @RequestMapping settings from the AbstractResource class? From AbstartResource's methods it overrides? From both?

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [July 3, 2019, 3:17pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/15 "2019-07-03T15:17:25Z")

</div>

TagResources methods will only be used if they are not first found in the AbstractResource.

I tried the updated java agent, but it doesn't change much, I still have the issue,

only dispatcherservlet is visible on the transactions page

![elas1](https://us1.discourse-cdn.com/elastic/original/3X/e/5/e552f1a88d7b2a694c6832955a80d2d5af07a7c3.png)

and then it's only in the drilldown that I see the methods that should be at the transaction level

 ![elas2](https://us1.discourse-cdn.com/elastic/original/3X/3/5/35b58405e368c3cf7a4a2439888c1ae956b8498d.png)

---

<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:** [July 4, 2019, 4:50am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/16 "2019-07-04T04:50:12Z")

</div>

The agent I provided is not for fixing the problem, it is for analysing it.  
Set `log_level=TRACE`, make sure your app is fully started and make a few requests to reproduce the problem. Then upload the log.

In addition, please describe how you installed the agent and provide the exact configuration you used for it (ie the relevant part of the script or the command line).

Lastly, please answer- are you using Spring WebFlux or any other component worth mentioning?

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [July 4, 2019, 11:18am UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/17 "2019-07-04T11:18:11Z")

</div>

Here's the elastic log using trace level with the javaagent that you supplied, I only gave the first 10000 lines.

...

My agent installation is done via the following command at the moment, have tried a number of variations but this is what I have right now

java -javaagent:C:\Users\my\Desktop\Elastic\javaagents\elastic-apm-agent-1.7.1-SNAPSHOT-app.jar -Delastic.apm.service\_name=my-App -Delastic.apm.log\_level=TRACE -Delastic.apm.log\_file=_AGENT\_HOME_/logs/elastic-apm.log -Delastic.apm.application\_packages=com.my -Delastic.apm.server\_urls=http://localhost:8200 -Delastic.apm.trace\_methods=com.my.services._#_ -jar myService-1.0.jar

Not using anything like Spring Webflux

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [July 9, 2019, 2:33pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/18 "2019-07-09T14:33:25Z")

</div>

Just for closure on this, I was able to get a resolution to my issue. I had been trying to use the following flag for disabling instrumentation;

disable\_instrumentations=dispatcher-servlet

as it seemed the most relevent

However after playing with different combinations of properties for a while, I was able to unmask my methods from the dispatcher servlet by using this property instead;

disable\_instrumentations=servlet-api

Unsure of the differences between them, but am happy that I'm able to move on to other elastic setup after spending a while on this.

Thanks for all your help.

---

<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:** [July 9, 2019, 2:44pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/19 "2019-07-09T14:44:09Z")

</div>

Sorry for not following up on this, got slipped...  
So, did you eventually get transaction named something like `ControllerName#methodName`?

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [July 9, 2019, 3:00pm UTC](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147/20 "2019-07-09T15:00:08Z")

</div>

Yeah pretty much, we also have trace methods on, so we're now getting className#methodName

[Next page](https://discuss.elastic.co/t/remove-spring-dispatcherservlet-from-transactions/187147.md?page=2)
