Using RESTEasy Tracing Feature With Feature Pack In WildFly

By Wei Nan Li | December 13, 2021

The RESTEasy Tracing Feature provides a way for the users to understand what’s going on internally in the container when a request is processed. Here are relative blogs relative to the feature:

And here is the document section introducing the feature:

This feature has been divided into two parts. One part is located inside the main repository:

It contains core parts of the feature. Because this part is located in resteasy-core, so it’s included in the new feature-pack descriptor:

So this part can be installed with Galleon command line tool. Here is the blog that describes the usage of RESTEasy Feature Pack and Galleon tool:

On the other side, the implementation part of the feature are mainly located in resteasy-extension sub-project:

So if you want to use the tracing feature in your project and deploy into WildFly, then you need to include the above module into your project dependency scope:

<dependency>
   <groupId>org.jboss.resteasy</groupId>
   <artifactId>resteasy-tracing-api</artifactId>
</dependency>

There is tracing sample project in the resteasy-examples repository:

And it can be packaged and deployed into WildFly. To package the above example, just clone the code into your local environment and then run the Maven command to package it:

$ mvn package

And then we can get the WAR file:

Because I cloned the resteasy-examples repository and used the main branch for packaging, so the version number is 4.2.1.Final-SNAPSHOT, which is the main branch SNAPSHOT version when I’m writing this blog.

After we get the WAR file, then we can use it to deploy into WildFly server. But before taking the action, please make sure you have followed this blog post to install the RESTEasy Feature Pack properly:

And then we can start the provisioned version of WildFly:

And then using the jboss-cli tool to do the sample project WAR file deployment:

➤ ./jboss-cli.sh                                                                                                                       connect localhostYou are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect localhost
[standalone@localhost:9990 /] deploy /Users/weli/work/resteasy-examples/tracing-example/target/tracing-example-5.0.0-SNAPSHOT.war
[standalone@localhost:9990 /]

And if everything goes fine, we can see the relative server output:

And then we can try to access the sample project service:

➤ http localhost:8080/tracing-example-5.0.0-SNAPSHOT/type

I’m using the httpie tool above instead of curl command because it supports color output, and here is the output of the command:

As the above screenshot shows, the tracing information is output correctly. And from server side we can also see the relative server output:

Until now we have make the Tracing Feature working with the provisioned WildFly which has RESTEasy Feature Pack installed.

         

YourKit
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor