5 minutes
The Payara Monthly Catch – October 2025
Welcome aboard the October issue of The Monthly Catch!As the leaves turn and conference season hits full stride, the […]
In today’s complex, distributed applications, pinpointing performance issues and understanding the flow of requests can be a hard task. Payara Server’s Request Tracing Service provides a reliable toolset for tracing requests across various protocols and components. This blog post looks at request tracing in Payara Server, offering a quick guide to its features, configuration and best practices.
Before diving in, let’s take a look at a breakdown of the essential terminology:
At its core, the Request Tracing Service does the following:
Payara Server’s Request Tracing Service covers a wide range of requests:
Payara Server recognizes the significance of these standards and prioritises OpenTelemetry while still providing support for legacy systems:
If you are starting a new project or considering a switch, OpenTelemetry is the recommended choice for its expanded capabilities, broader scope and active development community. Payara’s focus on OpenTelemetry reflects the industry shift towards this comprehensive observability standard.
Payara Server provides multiple ways to manage its Request Tracing Service:
For ease of use, Payara automatically traces several common request types:
When you need finer-grained control over your tracing, you have two primary options:
@RequestScoped
public class MyJaxRsResource {
@Traced // Traces the entire method
@GET
@Path("/items")
public List<Item> getItems() {
// ... your item retrieval logic ...
}
@Traced(operationName = "processItem") // Custom operation name
private Item processItem(Item rawItem) {
// ... your item processing logic ...
}
}
In this example:
Tracer Class:
Obtain an instance of the io.opentracing.Tracer class through @Inject, then use the Tracer to create and manage tracing spans for more customized tracking.
Example:
@RequestScoped
public class MyServiceBean {
@Inject
Tracer tracer;
public void doSomeWork() {
try (Span span = tracer.buildSpan("myCustomSpan").startActive(true)) {
// ... code to be traced within the span ...
span.setTag("dataProcessed", "importantData"); // Add a tag
span.log("Processing step completed"); // Add a log
}
}
}
In this example:
For basic tracing of most common components, automatic tracing often suffices.
If you need specific tracing behavior, customizing which operations are traced or adding additional data to traces, the @Traced annotation or the Tracer class will be your tools of choice.
Method-level control: Add the @Traced(false) annotation directly to specific methods or classes you wish to exclude from tracing.
Example:
@Traced(false)
@GET
public Response getHealthStatus() {
// ... health check logic
return Response.ok("Healthy!").build();
}
@Traced(false) // Disables tracing for all methods in the class
public class InternalService {
// ...
}
Pattern-based control: Define skip patterns using regular expressions within MicroProfile Config properties. This allows you to disable tracing for sets of resources that match the pattern.
Example (in your MicroProfile config file):
mp.opentracing.server.skip-pattern=/health.*
This pattern would disable tracing for any JAX-RS resource paths starting with “/health”.
Note that:
Unlock the power of Payara Server’s Request Tracing Service to debug issues, optimize performance and understand how your distributed applications work. Combine it with metrics and logging for a complete picture of your system’s health. This approach will streamline troubleshooting, enhance user experience and help you build more reliable applications. Download Payara Community today and explore the Request Tracing documentation to get started. Happy Coding!
Share:
5 minutes
Welcome aboard the October issue of The Monthly Catch!As the leaves turn and conference season hits full stride, the […]
5 minutes
Payara Cloud is becoming part of Payara Qube family of Java application deployment runtimes. This move reflects how the […]
6 minutes
If you’ve been living in the Spring ecosystem, you’re used to fast project setup. Spring Initializr gives you a […]
What are the differences between configuring via CMD (enableRequestTracing) and using asadmin?