-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Jakarta HealthCheckServlet object mapper and status indicator #3924
Conversation
- Allow overriding the `ObjectMapper` instance used in `HealthCheckServlet` with the servlet attribute `io.dropwizard.metrics.servlets.HealthCheckServlet.mapper` - Allow setting the HTTP status code used to indicate health to 200 (OK) with the servlet attribute `io.dropwizard.metrics.servlets.HealthCheckServlet.httpStatusIndicator`, or with the HTTP query parameter `httpStatusIndicator` per request Refs #1821 Refs #1871
260dca9
to
38e41a2
Compare
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
Quality Gate failedFailed conditions 78.6% Coverage on New Code (required ≥ 80%) |
final ServletConfig servletConfig = mock(ServletConfig.class); | ||
when(servletConfig.getServletContext()).thenReturn(servletContext); | ||
when(servletContext.getAttribute(HealthCheckServlet.HEALTH_CHECK_REGISTRY)).thenReturn(registry); | ||
when(servletContext.getAttribute(HealthCheckServlet.HEALTH_CHECK_MAPPER)).thenReturn("IRELLEVANT_STRING"); |
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.
irrelevant typo
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.
But at least it's a consistent type. 😂
❯ rg IRELLEVANT_STRING
metrics-servlets/src/test/java/com/codahale/metrics/servlets/MetricsServletTest.java
258: .thenReturn("IRELLEVANT_STRING");
metrics-servlets/src/test/java/com/codahale/metrics/servlets/HealthCheckServletTest.java
217: .thenReturn("IRELLEVANT_STRING");
229: when(servletContext.getAttribute(HealthCheckServlet.HEALTH_CHECK_MAPPER)).thenReturn("IRELLEVANT_STRING");
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/MetricsServletTest.java
258: .thenReturn("IRELLEVANT_STRING");
metrics-jakarta-servlets/src/test/java/io/dropwizard/metrics/servlets/HealthCheckServletTest.java
215: .thenReturn("IRELLEVANT_STRING");
227: when(servletContext.getAttribute(HealthCheckServlet.HEALTH_CHECK_MAPPER)).thenReturn("IRELLEVANT_STRING");
ObjectMapper
instance used inHealthCheckServlet
with the servlet attributeio.dropwizard.metrics.servlets.HealthCheckServlet.mapper
io.dropwizard.metrics.servlets.HealthCheckServlet.httpStatusIndicator
, or with the HTTP query parameterhttpStatusIndicator
per requestRefs #1821
Refs #1871
Fixes #3918