mirror of
https://github.com/hengyoush/kyanos.git
synced 2025-12-20 01:03:46 +08:00
refactor(cli): adjust cmd line help message
This commit is contained in:
@@ -20,12 +20,12 @@ sudo kyanos overview
|
||||
var overview bool
|
||||
|
||||
func init() {
|
||||
overviewCmd.PersistentFlags().StringVarP(&enabledMetricsString, "metrics", "m", "t", `Specify the statistical dimensions, including:
|
||||
t: total time taken for request response,
|
||||
q: request size,
|
||||
p: response size,
|
||||
n: network device latency,
|
||||
s: time spent reading from the socket buffer`)
|
||||
overviewCmd.PersistentFlags().StringVarP(&enabledMetricsString, "metric", "m", "t", `Specify the statistical dimensions, including:
|
||||
t/total-time: total time taken for request response,
|
||||
q/reqsize: request size,
|
||||
p/respsize: response size,
|
||||
n/network-time: network device latency,
|
||||
s/socket-time: time spent reading from the socket buffer`)
|
||||
|
||||
overviewCmd.Flags().SortFlags = false
|
||||
overviewCmd.PersistentFlags().SortFlags = false
|
||||
|
||||
@@ -28,10 +28,8 @@ sudo kyanos watch http --pid 1234 --path /foo/bar
|
||||
sudo kyanos watch redis --comands GET,SET
|
||||
sudo kyanos watch mysql --latency 100
|
||||
|
||||
sudo kyanos stat http --metrics t --interval 5
|
||||
sudo kyanos stat http --metrics t --group-by remote-ip
|
||||
sudo kyanos stat http --metrics t --samples 3 --full-body
|
||||
sudo kyanos stat http --metrics tq --sort-by avg --group-by remote-ip`,
|
||||
sudo kyanos stat http --metrics total-time
|
||||
sudo kyanos stat http --metrics total-time --group-by remote-ip`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
startAgent()
|
||||
},
|
||||
|
||||
22
cmd/stat.go
22
cmd/stat.go
@@ -18,26 +18,14 @@ var statCmd = &cobra.Command{
|
||||
# Basic Usage, only count HTTP connections, print results when press 'ctlc+c'
|
||||
sudo kyanos stat http
|
||||
|
||||
# Print results 5 seconds periodically
|
||||
sudo kyanos stat http -i 5
|
||||
|
||||
# Find the most slowly remote http server with '/example' api
|
||||
sudo kyanos stat http --metrics t --group-by remote-ip --side client --path /example
|
||||
sudo kyanos stat http --metrics tolal-time --group-by remote-ip --side client --path /example
|
||||
|
||||
# Same as above but also prints 3 slowest samples with full body
|
||||
sudo kyanos stat http --metrics t --samples 3 --full-body ...
|
||||
# Same as above but shorter
|
||||
sudo kyanos stat http --slow --path /example
|
||||
|
||||
# Specify two metrics total duration & request size
|
||||
sudo kyanos stat http --metrics tq --group-by remote-ip
|
||||
|
||||
# Sort by p99 of total duration's (default is 'avg')
|
||||
sudo kyanos stat http --metrics t --sort-by p99
|
||||
|
||||
# Limit the number of output connection results to 1.
|
||||
sudo kyanos stat http --metrics t --limit 1
|
||||
|
||||
# In addition to request-response time, also track request-response size.
|
||||
sudo kyanos stat http --metrics tqp
|
||||
# find the the remote client which requests big keys
|
||||
sudo kyanos stat redis --bigresp
|
||||
`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) { Mode = AnalysisMode },
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
@@ -8,14 +8,14 @@ import (
|
||||
|
||||
var maxRecords int
|
||||
var watchCmd = &cobra.Command{
|
||||
Use: "watch [http|redis|mysql [flags]]",
|
||||
Use: "watch [http|redis|mysql] [flags]",
|
||||
Example: `
|
||||
sudo kyanos watch
|
||||
sudo kyanos watch http --side server --pid 1234 --path /foo/bar --host ubuntu.com
|
||||
sudo kyanos watch redis --comands GET,SET --keys foo,bar --key-prefix app1:
|
||||
sudo kyanos watch mysql --latency 100 --req-size 1024 --resp-size 2048
|
||||
`,
|
||||
Short: "Watch the request/response pair and print body to the console",
|
||||
Short: "Capture the request/response recrods",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) { Mode = WatchMode },
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
list, err := cmd.Flags().GetBool("list")
|
||||
|
||||
Reference in New Issue
Block a user