forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve JFR integration in Quarkus REST
We are now able to capture events for all HTTP requests that are meant to be handled by Quarkus REST, whether they were successfully handled or not. Fixes: quarkusio#44976
- Loading branch information
Showing
18 changed files
with
429 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
...s/jfr/runtime/src/main/java/io/quarkus/jfr/runtime/http/rest/JfrReactiveServerFilter.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...untime/src/main/java/io/quarkus/jfr/runtime/http/rest/ReactiveServerRecorderProducer.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
extensions/jfr/runtime/src/main/java/io/quarkus/jfr/runtime/http/rest/Recorder.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...untime/src/main/java/io/quarkus/jfr/runtime/http/rest/reactive/ReactiveServerFilters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package io.quarkus.jfr.runtime.http.rest.reactive; | ||
|
||
import org.jboss.logging.Logger; | ||
import org.jboss.resteasy.reactive.server.ServerRequestFilter; | ||
import org.jboss.resteasy.reactive.server.ServerResponseFilter; | ||
import org.jboss.resteasy.reactive.server.SimpleResourceInfo; | ||
|
||
public class ReactiveServerFilters { | ||
|
||
private static final Logger LOG = Logger.getLogger(ReactiveServerFilters.class); | ||
|
||
private final ReactiveServerRecorder recorder; | ||
|
||
public ReactiveServerFilters(ReactiveServerRecorder recorder) { | ||
this.recorder = recorder; | ||
} | ||
|
||
/** | ||
* Executed if request processing proceeded correctly. | ||
* We now have to update the start event with the resource class and method data and also commit the event. | ||
*/ | ||
@ServerRequestFilter | ||
public void requestFilter(SimpleResourceInfo resourceInfo) { | ||
Class<?> resourceClass = resourceInfo.getResourceClass(); | ||
if (resourceClass != null) { // should always be the case | ||
String resourceClassName = resourceClass.getName(); | ||
String resourceMethodName = resourceInfo.getMethodName(); | ||
recorder | ||
.updateResourceInfo(new ResourceInfo(resourceClassName, resourceMethodName)) | ||
.commitStartEventIfNecessary(); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* This will execute regardless of a processing failure or not. | ||
* If there was a failure, we need to check if the start event was not commited | ||
* (which happens when request was not matched to any resource method) and if so, commit it. | ||
*/ | ||
@ServerResponseFilter | ||
public void responseFilter() { | ||
if (LOG.isDebugEnabled()) { | ||
LOG.debug("Enter Jfr Reactive Response Filter"); | ||
} | ||
recorder | ||
.recordEndEvent() | ||
.endPeriodEvent(); | ||
} | ||
|
||
} |
Oops, something went wrong.