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

Use JMX to expose tomcat sessions metrics #1620

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

baptistemesta
Copy link

This avoid using the manager and allows to have sessions related metrics
even if the application is not a spring application.

This is a Work in progress.
If maintainers think it's a good idea I can work on that and:

  • Replace Manager by JMX completely
  • Update tests and add new test to verify the behavior with JMX
  • Update the autoconfigurations

This avoid using the manager and allows to have sessions related metrics
even if the application is not a spring application.
@shakuzen shakuzen added the enhancement A general enhancement label Oct 17, 2019
@shakuzen shakuzen added this to the 1.x milestone Oct 17, 2019
@shakuzen
Copy link
Member

This avoid using the manager and allows to have sessions related metrics
even if the application is not a spring application.

Could you elaborate more on why using the Tomcat Manager makes it not usable outside of Spring applications?
Retrieving metrics from JMX queries has a track record of being fragile and error-prone (a recent example is #1778). When the same metrics are available from a strongly typed and versioned API, we generally prefer that.

@baptistemesta
Copy link
Author

Hi,
Thank you for taking the time to check that.

What I meant is that, if you are in an application where the tomcat is not embedded (i.e. an old school WAR application), the application does not have access to the instance of org.apache.catalina.Manager
So it not possible to use any tomcat sessions metrics

When using Spring boot, Spring starts the tomcat for you. It keeps the reference to the Manager and everything works well.

I did not found a way to retrieve this Manager in a classic WAR application, maybe I just missed something obvious.

@shakuzen
Copy link
Member

What I meant is that, if you are in an application where the tomcat is not embedded (i.e. an old school WAR application), the application does not have access to the instance of org.apache.catalina.Manager

I see what you mean now. Thanks for the clarification.

I did not found a way to retrieve this Manager in a classic WAR application, maybe I just missed something obvious.

I'm not sure either. We'll have to check with someone more knowledgeable about that than me. I suspect the answer from Tomcat might be that the way to do it is to use the JMX query, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants