Skip to content

Consider providing Micrometer integration #1495

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

Open
vpavic opened this issue Aug 26, 2019 · 1 comment
Open

Consider providing Micrometer integration #1495

vpavic opened this issue Aug 26, 2019 · 1 comment
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@vpavic
Copy link
Contributor

vpavic commented Aug 26, 2019

We could consider exposing some session related metrics using Micrometer.

@anessi
Copy link

anessi commented Sep 19, 2022

When enabling Spring Session (e.g. with Redis) on a Spring Boot app using embedded Tomcat one can notice that the tomcat.sessions.* metrics no longer get updated. These values are very useful for monitoring the application. These are the available metrics in tomcat:

tomcat.sessions.active.current
tomcat.sessions.active.max
tomcat.sessions.alive.max
tomcat.sessions.created
tomcat.sessions.expired
tomcat.sessions.rejected

It would be very nice to get similar metrics from Spring Session.


Below two example stack traces for how the tomcat.sessions.created metric is set.

Without Spring Sessions:

createSession:725, ManagerBase (org.apache.catalina.session)
doGetSession:3093, Request (org.apache.catalina.connector)
getSession:2493, Request (org.apache.catalina.connector)
getSession:908, RequestFacade (org.apache.catalina.connector)
getSession:920, RequestFacade (org.apache.catalina.connector)
getSession:249, HttpServletRequestWrapper (javax.servlet.http)
...
doRequest:193, LoginServlet (xxxxxx.servlet)
doGet:53, BaseServlet (xxxxxx.servlet)
service:645, HttpServlet (javax.servlet.http)
...

With Spring Session enabled (spring-session-data-redis:2.6.0):

createSession:509, RedisIndexedSessionRepository (org.springframework.session.data.redis)
createSession:251, RedisIndexedSessionRepository (org.springframework.session.data.redis)
getSession:323, SessionRepositoryFilter$SessionRepositoryRequestWrapper (org.springframework.session.web.http)
getSession:332, SessionRepositoryFilter$SessionRepositoryRequestWrapper (org.springframework.session.web.http)
getSession:193, SessionRepositoryFilter$SessionRepositoryRequestWrapper (org.springframework.session.web.http)
getSession:249, HttpServletRequestWrapper (javax.servlet.http)
...
doRequest:193, LoginServlet (xxxxxx.servlet)
doGet:53, BaseServlet (xxxxxx.servlet)
service:645, HttpServlet (javax.servlet.http)

The number of created sessions provided by the metric tomcat.sessions.created is stored on the ManagerBase class and retrieved using:

getSessionCounter:944, ManagerBase (org.apache.catalina.session)
applyAsDouble:-1, 1596426482 (io.micrometer.core.instrument.binder.tomcat.TomcatMetrics$$Lambda$1376)
count:39, CumulativeFunctionCounter (io.micrometer.core.instrument.cumulative)
get:-1, 49082497 (io.micrometer.core.instrument.FunctionCounter$$Lambda$1546)
getValue:39, Measurement (io.micrometer.core.instrument)
lambda$mergeMeasurements$5:131, MetricsEndpoint (org.springframework.boot.actuate.metrics)
...
accept:-1, 1871920265 (org.springframework.boot.actuate.metrics.MetricsEndpoint$$Lambda$1545)
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants