-
Notifications
You must be signed in to change notification settings - Fork 416
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
Application health status check #3379
Conversation
b4133ad
to
bdcd26b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, the test should not test the increasing of the queue, it's not a pertinent metric.
Expected test:
WaitingJobsCount == 0 => True
LastExecutedJobTimestamp > now - FloatingWindow => True
otherwise => False
The pseudocode we wrote together was better, but I don't remember it!
core/src/main/java/org/mapfish/print/metrics/ApplicationStatus.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/mapfish/print/metrics/ApplicationStatusTest.java
Outdated
Show resolved
Hide resolved
Examples of the responses of the
{
"application": {
"healthy": true,
"message": "sbr test.",
"duration": 0,
"timestamp": "2024-08-29T13:44:58.398Z"
}
} Response code: HTTP code
{
"application": {
"healthy": false,
"message": "sbr test.",
"duration": 0,
"timestamp": "2024-08-29T13:44:58.398Z"
}
} Response code: HTTP status code
{
"application": {
"healthy": false,
"message": "sbr test.",
"error": {
"type": "java.lang.RuntimeException",
"message": "sbr test.",
"stack": [
"org.mapfish.print.metrics.ApplicationStatus.check(ApplicationStatus.java:15)",
"com.codahale.metrics.health.HealthCheck.execute(HealthCheck.java:374)",
"com.codahale.metrics.health.HealthCheckRegistry.runHealthChecks(HealthCheckRegistry.java:184)",
"com.codahale.metrics.servlets.HealthCheckServlet.runHealthChecks(HealthCheckServlet.java:177)",
"com.codahale.metrics.servlets.HealthCheckServlet.doGet(HealthCheckServlet.java:146)",
"javax.servlet.http.HttpServlet.service(HttpServlet.java:529)",
"javax.servlet.http.HttpServlet.service(HttpServlet.java:623)",
"com.codahale.metrics.servlets.AdminServlet.service(AdminServlet.java:153)",
"javax.servlet.http.HttpServlet.service(HttpServlet.java:623)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:209)",
"com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:244)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:112)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:352)",
"org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:117)",
"org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)",
"org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:131)",
"org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:85)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)", "org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:164)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)", "org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:168)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)",
"org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:62)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)",
"org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:133)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:361)",
"org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:225)",
"org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190)",
"org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)",
"org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"org.mapfish.print.servlet.RequestSizeFilter.doFilter(RequestSizeFilter.java:40)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:168)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:144)",
"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)",
"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)",
"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)",
"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)",
"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)",
"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)",
"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:346)",
"org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:388)",
"org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)",
"org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:936)",
"org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1791)",
"org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)",
"org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)",
"org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)",
"org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)",
"java.base/java.lang.Thread.run(Thread.java:829)"
]
},
"duration": 0,
"timestamp": "2024-08-29T13:46:38.000Z"
}
} Response code: HTTP code |
1st: 2nd:
|
We have 3 states: Comparison of 2 options: 1st: 2nd: Pros and cons: 2nd: |
Since I have been asked for my insight on this topic, I felt 2 different usecases for the endpoint:
The main question is in which side to put the "Sick" state: either on "healthy" or on "dying" side. I would be in favor of the first suggested solution, because setting an extra java property at startup sounds to me as a special configuration case framework-wise, which is not supposed to be the default behaviour, and probably for a good reason. "Sick" also sounds to me more like a "Yes, but ..." with extra investigation to perform, but the service should still be available but like in a degraded state, so maybe it makes sense to still consider it as OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed for tests :-)
No description provided.