Analyzer
Table of Contents
Introduction
An analyzer is a scripting tool used to solve and analyze various program problems.
Each analyzer has its own purpose.
This command can be used to list, search, create and run analysis tools.
Usage
Usage: orxray analyzer command [OPTIONS]
COMMAND:
create
run
list
search
GLOBAL OPTIONS:
--help
--config specify config file, default is ~/.orxray/config.
Create
This subcommand used to create a new analyzer.
Usage
Usage: orxray analyzer create <name> [OPTIONS]
OPTIONS:
--desc description.
--ysql ysql.
--ylang ylang.
--ylua ylua.
--opslang opslang.
GLOBAL OPTIONS:
--help
--config specify config file, default is ~/.orxray/config.
<name>
each analyzer has its own name
--desc "Description"
description of this analyzer
--ysql 'YSQL code'
specify YSQL code of this analyzer
--ylang 'Ylang code'
specify Ylang code of this analyzer
--ylua 'Ylua code'
specify Ylua code of this analyzer
--opslang 'Opslang code'
specify Opslang code of this analyzer
Example
Create an analyzer use YSQL to print memory information of the process.
$ orxray analyzer create cli-test --ysql 'select res_mem from proc'
ID: 10075
Run
Run the analyzer by name you specify
Usage
Usage: orxray analyzer run tool [OPTIONS]
OPTIONS:
-a, --agent integer agent id, please use agent default command to set default agent.
-p, --pid integer pid. If pid is negative, will auto find the pgid of the -pid.
-c, --exe string command.
-t integer sample time in seconds.
--y-var ylang variable. Change the Ylang variable in runtime.
GLOBAL OPTIONS:
--help
--config specify config file, default is ~/.orxray/config.
Example
The command analyze process 4502 on the default agent. The tool will analyze and get the flame graph. After the task finished, you can goto the URI printed to show the flame graph.
$ orxray analyzer run c-on-cpu -p 4502
Goto https://your_id.xray.openresty.com/targets/27/history/8885766 for charts.
The command analyze process group to which process 4502 belongs on the default agent. Be careful, we pass -4502 as the argument of -p.
$ orxray analyzer run c-on-cpu -p -4502
Goto https://your_id.xray.openresty.com/targets/27/history/8885767 for charts.
The command below analyze process 4502 with argument pcre_unwind=1.
$ orxray analyzer run lj-c-on-cpu -p -4502 --y-var pcre_unwind=1
Goto https://your_id.xray.openresty.com/targets/27/history/8885767 for charts.
List
This subcommand list all the analyzers.
Usage
Usage: orxray analyzer list
OPTIONS:
-s, --page-size integer page size, 10(default).
GLOBAL OPTIONS:
--help
--config specify config file, default is ~/.orxray/config.
-s, --page-size integer
Specify the size of list returned.
Example
$ orxray analyzer list
ID NAME DESCRIPTION
1 count-on-cpu-frames count on cpu frames
2 count-off-cpu-frames count off cpu frames
3 lj-c-on-cpu C-land CPU Flame Graph
7 c-on-cpu C-land CPU Flame Graph
8 c-off-cpu C-land off-CPU Flame Graph
9 kernel-on-cpu kernel-land on-CPU Flame Graph
11 resty-memory Application-Level Memory Usage Breakdown
12 count-lj-newgco-frames count LuaJIT new GC objects frames
14 glibc-chunks Distributions of Memory Chunk Sizes in Glibc Allocator
15 lj-gco-stat Statistics for LuaJIT GC Objects
Search
This subcommand search analyzers by keyword.
Usage
Usage: orxray tool search WORD [OPTIONS]
OPTIONS:
-s, --page-size integer page size, 10(default).
GLOBAL OPTIONS:
--help
--config specify config file, default is ~/.orxray/config.
-s, --page-size integer
Specify the size of list returned.
Example
$ orxray analyzer search cpu
count-on-cpu-frames
count-off-cpu-frames
lj-c-on-cpu
lj-lua-on-cpu
lj-c-off-cpu
lj-lua-off-cpu
c-on-cpu
c-off-cpu
kernel-on-cpu
count-lj-c-on-cpu