Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple service names #136

Closed
felixbarny opened this issue Jul 24, 2018 · 11 comments · Fixed by #514
Closed

Support multiple service names #136

felixbarny opened this issue Jul 24, 2018 · 11 comments · Fixed by #514
Assignees

Comments

@felixbarny
Copy link
Member

felixbarny commented Jul 24, 2018

In application servers, it is possible to deploy multiple applications. Currently, the agent only supports one service name per JVM.

This should add the ability to configure one service name per javax.servlet.ServletContext#getContextPath.

@felixbarny
Copy link
Member Author

Blocked by elastic/apm-server#1175

@alvarolobato
Copy link
Contributor

alvarolobato commented Feb 26, 2019

This is not blocked anymore elastic/apm-server#1175 is done.

@wolframhaussig
Copy link
Contributor

Is there an ETA for this? We would appreciate this as it makes our task a lot easier.

@felixbarny felixbarny self-assigned this Mar 5, 2019
felixbarny added a commit to felixbarny/apm-agent-java that referenced this issue Mar 5, 2019
Enables to have multiple service names per JVM,
one per class loader.

closes elastic#136
@felixbarny
Copy link
Member Author

@wolframhaussig I'm currently working on this so it won't be too long probably 🙂

I assume you want this so that you can have different service names for different applications deployed to the same application server?

The way I have implemented this is that it takes the display-name from the web.xml or the context path. If the display name is not set and the application is mapped to the root context, the service name will be the name of the application server (for example tomcat-application).

@wolframhaussig
Copy link
Contributor

@felixbarny
Partially: We have multiple tomcat installations with n applications on each. This would be resolved if I understand you right.
The other thing is that we have webservices in an Axis2 container. As I understand you these webservices would all show as "Apache-Axis2" as this is defined in the Axis2 web.xml, right? In this case I would be happy if it was possible to manully match the application name to the Url...

@felixbarny
Copy link
Member Author

we have webservices in an Axis2 container

Could you specify what you mean by that? Do you mean the Axis2 standalone server?

As I understand you these webservices would all show as "Apache-Axis2" as this is defined in the Axis2 web.xml, right?

Are all of these webservices packaged in the same war file? How would you differ between them? Does it contain multiple Axis2 servlets which are mapped to different URLs?

Another thing to note here is that general JVM metrics like GC statistics will use the service name configured in service.name or the default name.

@wolframhaussig
Copy link
Contributor

I meant the Axis2 webApp. Our structure is this:
Tomcat

  • WebApp 1
  • WebApp 2
  • WebApp N
  • Axis2

In the Axis2 webApp there is a directory WEB-INF/services- In this directory are over 60 .aar files.
If the url mappings were possible I could do something like this:
/axis2/services/ws1 => ws1
/axis2/services/ws2 => ws2

Currently I always see AxisServlet#doPost as name. Of course it would be cool if the apm agent would recognise the service.name from the Axis2 services...

@felixbarny
Copy link
Member Author

Would it be an option for you to enable use_path_as_transaction_name so that the transactions have different names?

@wolframhaussig
Copy link
Contributor

That would be fine for me.
In the documentation is a note:

If set to true, transaction names of unsupported Servlet API-based frameworks will be in the form of $method $path instead of just $method.

So this would currently not work as the Axis2 controller is already recognised, right?

@felixbarny
Copy link
Member Author

So this would currently not work as the Axis2 controller is already recognised, right?

Hmm, yeah, that's true. Forgot about that.

Another approach could be to set the transaction name in a custom servlet filter manually: https://www.elastic.co/guide/en/apm/agent/java/current/public-api.html#api-set-name

@wolframhaussig
Copy link
Contributor

I will leave it for now as I am not happy to modify hundreds of web applications/web services. As a fallback I might reconfigure the apm server to logstash output and do the mapping from url to transaction there.

felixbarny added a commit that referenced this issue Mar 21, 2019
Enables to have multiple service names per JVM,
one per class loader.

closes #136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants