Skip to content

WebRequestTraceFilter calls methods on the request and response to retrieve information that then isn't included in the trace #14550

@hpresnall

Description

@hpresnall

org.springframework.boot.actuate.trace.WebRequestTraceFilter.getTrace() is calling a number of methods on the request even when they are not going to be included in the trace. The issue is that the add method is passed an Include and the data to include. This function calls that generate the data are called even if add never actually adds anything to the trace.

This came up during performance testing of an application at loads of about 500 requests per second. In particular, the call to getPathTranslated() was showing up in profiles as taking 5% of the overall execution time. On Linux with openjdk, this method makes native filesystem calls which are relatively slow. This is especially bad since DEFAULT_INCLUDES does not include this data and it's never put in the trace. If I remove this one call, I see between a 5% and 50% improvement in throughput depending on total throughput and concurrency.

The add method should be reworked so that the data is not generated until it is added to the trace.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions