Analyzer ngx-req-latency

Name

ngx-req-latency - Nginx Request Latency

This analyzer monitors and analyzes HTTP request latency in Nginx-based applications such as OpenResty, Kong. It captures detailed timing information for each request phase including rewrite time, header processing time, access time, content generation time, and upstream response time. The analyzer can filter requests by status code, host, URI, and latency thresholds, and optionally capture network packets for matched requests. It provides comprehensive insights into request processing performance and helps identify slow requests and their causes.

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 -p PID

# trace a shell command directly
orxray analyzer run ngx-req-latency -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 -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run ngx-req-latency --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Line Charts
  • Plain Texts

Output Example

{
  "stat": {
    "total": 1,
    "matched": 1,
    "missed": 0,
    "time": 30
  },
  "reqs": [
    {
      "method": "GET",
      "uri": "/example",
      "time": "1764820856",
      "rewrite_time": "0",
      "header_time": "0",
      "upstream_retry": "0",
      "keepalive": "0",
      "scheme": "http",
      "upstream_start_time": "0",
      "send_response_time": "0",
      "upstream_response_time": "0",
      "upstream_header_time": "1",
      "upstream_connect_time": "0",
      "request_time": "1",
      "content_time": "0",
      "host": "192.168.1.101",
      "access_time": "0"
    }
  ]
}

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.