public class RequestProfiler
A profiler that would periodically generate a report for the past period with the latency report for the slowest requests. This is used for debugging only. A request id would be generated for each request at runtime. Certain part of the code would be wrapped with startOperation(...) and endOperation(...) to measure the latency of operations of individual request.
The report will contain the execution details of the TOP_K slowest requests, one example:
INFO: During the last 60000 milliseconds at system time 1720825020138, in total 2 requests finished. Total dropped request is 0. The top 10 long latency requests details report:
Request uuid: request_1 with total time 1000 milliseconds
Operation name json_to_proto_conversion starts at: 1720566109971, ends at: 1720566109971, total time: 200 milliseconds
Operation name backend_latency starts at: 1720566109971, ends at: 1720566109971, total time: 800 milliseconds
Request uuid: request_2 with total time 500 milliseconds
Operation name json_to_proto_conversion starts at: 1720566109971, ends at: 1720566109971, total time: 250 milliseconds
Operation name backend_latency starts at: 1720566109971, ends at: 1720566109971, total time: 250 milliseconds
...
Static Methods
disableAndResetProfiler()
public static void disableAndResetProfiler()
setReportPeriod(Duration flushPeriod)
public static void setReportPeriod(Duration flushPeriod)
Parameter | |
---|---|
Name | Description |
flushPeriod |
Duration |
setTopKRequestsToLog(int topK)
public static void setTopKRequestsToLog(int topK)
Parameter | |
---|---|
Name | Description |
topK |
int |
Constructors
RequestProfiler()
public RequestProfiler()