Analyzer ngx-req-latency-advance
Name
ngx-req-latency-advance - Nginx Request Latency with Lua Profiling
This analyzer profiles request latency in Nginx-based applications including OpenResty, Kong, and other Nginx variants, with enhanced support for Lua code profiling. In addition to capturing detailed timing information for HTTP requests (total request time, upstream response time, and various processing phases), it can also analyze Lua execution time within the request lifecycle. The analyzer filters requests by status code, host, URI, and time thresholds, and optionally captures network packets for matched requests. By providing visibility into both native Nginx processing and Lua code execution, it helps identify performance bottlenecks in applications that heavily rely on Lua scripting, such as OpenResty-based services.
Resource Category
Latency.
Application Type & Technical Stack
- OpenResty
- Nginx
- Kong
- APISIX
Command Line Syntax
The analyzer can be invoked directly on the command-line via the orxray
utility from the openresty-xray-cli software package.
Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).
# PID is the target process PID.
orxray analyzer run ngx-req-latency-advance -p PID
# trace a shell command directly
orxray analyzer run ngx-req-latency-advance -c SHELL_CMD
# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-req-latency-advance -p -PGID
# trace any processes started from the specified executable path.
orxray analyzer run ngx-req-latency-advance --exe /path/to/exe/file
Tracing Multiple Processes
Supported.
Output Formats
- Line Charts
- Plain Texts
Output Example
{
"stat": {
"total": 1,
"missed": 0,
"matched": 1,
"time": 10
},
"reqs": [
{
"header_time": "0",
"access_time": "0",
"content_time": "0",
"upstream_retry": "0",
"scheme": "http",
"upstream_start_time": "0",
"upstream_header_time": "1",
"upstream_connect_time": "0",
"time": "1764821054",
"host": "192.168.1.101",
"upstream_response_time": "0",
"uri": "/view/remains",
"keepalive": "0",
"request_time": "1",
"method": "GET",
"send_response_time": "0",
"rewrite_time": "0"
}
]
}
Author
The OpenResty Inc. Team.
Copyright
Copyright (C) by OpenResty Inc. All rights reserved.