Describe the bug
After updating to Jetty12 a lot of requests that were previously marked as Outcome SUCCESS are now Outcome UNKNOWN. One example of this happening is when we are showing index.jsp files through the "welcome" system of a WebAppContext.
The TimedHandler stores the request status in onResponseBegin. At that moment, the status is still 0, so is marked as UNKNOWN. In onComplete we do have the correct status available, so should the capturing of the status move to onComplete instead?
Workaround
Override the status stored in onResponseBegin in the onComplete.
TimedHandler timedHandler = new TimedHandler(globalRegistry, Tags.empty()) {
// The Response status code is originally stored onResponseBegin, which is too early
// This override copies it to onComplete, which is the last step of the request processing, ensuring that the correct status code is recorded in the metrics.
@Override
protected void onComplete(Request request, int status, HttpFields headers, Throwable failure) {
request.setAttribute(RESPONSE_STATUS_ATTRIBUTE, status);
super.onComplete(request, status, headers, failure);
}
};
Environment
- Micrometer version: 1.16.3
- Micrometer registry: prometheus
- OS: Windows and Linux
- Java version: openjdk 21.0.9 2025-10-21 LTS
Expected behavior
The request outcome is properly marked as SUCCESS instead of UNKNOWN.
Describe the bug
After updating to Jetty12 a lot of requests that were previously marked as Outcome SUCCESS are now Outcome UNKNOWN. One example of this happening is when we are showing index.jsp files through the "welcome" system of a
WebAppContext.The
TimedHandlerstores the request status inonResponseBegin. At that moment, the status is still 0, so is marked as UNKNOWN. InonCompletewe do have the correct status available, so should the capturing of the status move to onComplete instead?Workaround
Override the status stored in
onResponseBeginin theonComplete.Environment
Expected behavior
The request outcome is properly marked as SUCCESS instead of UNKNOWN.