Analyzer ngx-http-rewrite-time

Name

ngx-http-rewrite-time - Nginx HTTP Rewrite Phase Latency

This analyzer profiles the latency of Nginx HTTP rewrite phase processing in applications such as OpenResty, Kong, and APISIX. It captures timing data for URL rewriting operations, internal redirects, and rewrite module execution. The analyzer produces histogram distributions of rewrite phase latencies, enabling identification of inefficient rewrite rules, complex regular expression patterns, and configuration issues that impact request processing performance.

Resource Category

Latency.

Application Type & Technical Stack

  • OpenResty
  • 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-http-rewrite-time -p PID

# trace a shell command directly
orxray analyzer run ngx-http-rewrite-time -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-http-rewrite-time -p -PGID

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

Tracing Multiple Processes

Supported.

Output Formats

  • Histogram Bar Charts
  • Plain Texts

Output Example

{
  "data": {
    "distribution": [
      {"count": 0, "key": "1"},
      {"count": 0, "key": "2"},
      {"count": 1, "key": "4"},
      {"count": 28, "key": "8"},
      {"count": 1, "key": "16"},
      {"count": 0, "key": "32"},
      {"count": 0, "key": "64"}
    ],
    "unit": "us",
    "summary": {
      "min": 7,
      "max": 28,
      "count": 30,
      "sum": 344
    }
  },
  "kind": "rewrite-latency"
}

Author

The OpenResty Inc. Team.

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