You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use clap::{AppSettings,ArgEnum,ArgMatches,IntoApp,Parser,Subcommand};
1
+
use clap::{AppSettings,IntoApp,Parser,Subcommand};
2
2
use clap_complete::{
3
3
generate,
4
4
shells::{Bash,Fish,PowerShell,Zsh},
@@ -8,7 +8,7 @@ use std::path::PathBuf;
8
8
use core::commands;
9
9
use utils::app_config::AppConfig;
10
10
use utils::error::Result;
11
-
use utils::types::{LogLevel,OutputFormat,Spy};
11
+
use utils::types::{LogLevel,Spy};
12
12
13
13
#[derive(Parser,Debug)]
14
14
#[clap(
@@ -33,179 +33,6 @@ pub struct Cli {
33
33
/// Pyroscope CLI Commands
34
34
#[derive(Subcommand,Debug)]
35
35
enumCommands{
36
-
#[clap(
37
-
name = "adhoc",
38
-
about = "Profile a process and save the results to be used in adhoc mode",
39
-
long_about = "
40
-
adhoc command is a complete toolset to profile a process and save the profiling
41
-
results.
42
-
These results are generated in two different ways:
43
-
- Pyroscope stores the profiling data in its native format and data directory
44
-
by default. These profiles are then available for analysis using pyroscope UI
45
-
(the 'Adhoc Profiling' section), which requires a running pyroscope server.
46
-
This output can be disabled with '--no-json-output'.
47
-
- Pyroscope also generates profiling data in an external format.
48
-
Depending on the number of generated profiles, pyroscope will generate either
49
-
a file or a directory, in the directory where pyroscope is run from.
50
-
The currently supported formats are standalone HTML (which can then be
51
-
shared or directly open in a browser to analyze), pprof or collapsed
52
-
(these last two can then be shared and used with either pyroscope UI or other
53
-
tooling). The flag '--output-format' is used to specify this format.
54
-
There are multiple ways to gather the profiling data, and not all of them are
55
-
available for all the languages.
56
-
Which way is better depends on several factors: what the language supports,
57
-
how the profiled process is launched, and how the profiled process provides
58
-
the profiled data.
59
-
The different supported ways are:
60
-
- exec. In this case, pyroscope creates a different process for the profiled
61
-
program and uses a spy to directly gather profiling data. It's a useful way
62
-
to profile a whole execution of some program that has no other pyroscope
63
-
integration or way of exposing profiling data.
64
-
It's the default mode for languages with a supported spy when either the spy
65
-
name is specified (through '--spy-name' flag) or when the spyname is
66
-
autodetected.
67
-
- connect. Similar to exec, pyroscope uses a spy to gather profiling data,
68
-
but instead of creating a new profiled process, it spies an already running
69
-
process, indicated through '--pid' flag.
70
-
- push. In this case, pyroscope creates a different process for the profiled
71
-
program and launches an HTTP server with an ingestion endpoint. It's useful
72
-
to profile programs already integrated with Pyroscope using its HTTP API.
73
-
Push mode is used by default when no spy is detected and no '--url' flag is
74
-
provided. It can also be override the default exec mode with the '--push' flag.
75
-
- pull. In this case, pyroscope periodically connects to the URL specified
76
-
thorugh '--url' where it tries to retrieve profiling data in any of the
77
-
supported formats. In this case arguments are optional, and if provided,
78
-
they are used to launch a new process before polling the URL.
79
-
"
80
-
)]
81
-
Adhoc{
82
-
#[clap(
83
-
name = "application_name",
84
-
long = "application-name",
85
-
value_name = "APPLICATION_NAME",
86
-
help = "application name used when uploading profiling data"
87
-
)]
88
-
application_name:Option<String>,
89
-
#[clap(
90
-
name = "data_path",
91
-
long = "data-path",
92
-
value_name = "DATA_PATH",
93
-
help = "directory where pyroscope stores adhoc profiles"
94
-
)]
95
-
data_path:String,
96
-
#[clap(
97
-
name = "detect_subprocesses",
98
-
long = "detect-subprocesses",
99
-
value_name = "DECTECT_SUBPROCESSES",
100
-
help = "keep track of and profile subprocesses of the main process"
101
-
)]
102
-
detect_subprocesses:bool,
103
-
#[clap(
104
-
name = "duration",
105
-
long = "duration",
106
-
value_name = "DURATION",
107
-
help = "duration of the profiling session, which is the whole execution of the profiled process by default",
108
-
default_value = "0s"
109
-
)]
110
-
duration:String,
111
-
#[clap(
112
-
name = "log_level",
113
-
short,
114
-
long = "log-level",
115
-
value_name = "LOG_LEVEL",
116
-
help = "",
117
-
default_value = "info"
118
-
)]
119
-
log_level:LogLevel,
120
-
#[clap(
121
-
name = "no_logging",
122
-
long = "no-logging",
123
-
value_name = "NO_LOGGING",
124
-
help = "disable logging from pyroscope"
125
-
)]
126
-
no_logging:bool,
127
-
#[clap(
128
-
name = "max_nodes_render",
129
-
long = "max-nodes-render",
130
-
value_name = "MAX_NODES_RENDER",
131
-
help = "max number of nodes used to display data on the frontend",
132
-
parse(try_from_str),
133
-
default_value = "8192"
134
-
)]
135
-
max_nodes_render:u32,
136
-
#[clap(
137
-
name = "max_nodes_serialization",
138
-
long = "max-nodes-serialization",
139
-
value_name = "MAX_NODES_SERIALIZATION",
140
-
help = "max number of nodes used when saving profiles to disk",
141
-
parse(try_from_str),
142
-
default_value = "2048"
143
-
)]
144
-
max_nodes_serialization:u32,
145
-
#[clap(
146
-
name = "no_json_output",
147
-
long = "no-json-output",
148
-
value_name = "NO_JSON_OUTPUT",
149
-
help = "disable generating native JSON file(s) in pyroscope data directory"
150
-
)]
151
-
no_json_output:bool,
152
-
#[clap(
153
-
name = "output_format",
154
-
long = "output-format",
155
-
value_name = "OUTPUT_FORMAT",
156
-
help = "format to export profiling data",
157
-
default_value = "html"
158
-
)]
159
-
output_format:OutputFormat,
160
-
#[clap(
161
-
name = "pid",
162
-
long = "pid",
163
-
value_name = "PID",
164
-
help = "PID of the process you want to profile. Pass -1 to profile the whole system (only supported by ebpfspy)",
165
-
parse(try_from_str),
166
-
default_value = "0"
167
-
)]
168
-
pid:i32,
169
-
#[clap(
170
-
name = "push",
171
-
long = "push",
172
-
value_name = "PUSH",
173
-
help = "use push mode, exposing an ingestion endpoint for the profiled program to use"
174
-
)]
175
-
push:bool,
176
-
#[clap(
177
-
name = "pyspy_blocking",
178
-
long = "pyspy-blocking",
179
-
value_name = "PYSPY_BLOCKING",
180
-
help = "enable blocking mode for pyspy"
181
-
)]
182
-
pyspy_blocking:bool,
183
-
#[clap(
184
-
name = "rbspy_blocking",
185
-
long = "rbspy-blocking",
186
-
value_name = "RBSPY_BLOCKING",
187
-
help = "enable blocking mode for rbspy"
188
-
)]
189
-
rbspy_blocking:bool,
190
-
#[clap(
191
-
name = "sample_rate",
192
-
long = "sample-rate",
193
-
value_name = "SAMPLE_RATE",
194
-
help = "sample rate for the profiler in Hz. 100 means reading 100 times per second",
195
-
default_value = "100"
196
-
)]
197
-
sample_rate:i32,
198
-
#[clap(
199
-
name = "spy_name",
200
-
long = "spy-name",
201
-
value_name = "SPY_NAME",
202
-
help = "name of the profiler to use",
203
-
default_value = "auto"
204
-
)]
205
-
spy_name:Spy,
206
-
#[clap(long, value_name = "URL", help = "URL to gather profiling data from")]
207
-
url:Option<String>,
208
-
},
209
36
#[clap(
210
37
name = "completion",
211
38
about = "Generate the autocompletion script for pyroscope for the specified shell. See each sub-command's help for details on how to use the generated script.",
@@ -228,13 +55,14 @@ they are used to launch a new process before polling the URL.
228
55
help = "application name used when uploading profiling data"
229
56
)]
230
57
application_name:Option<String>,
231
-
#[clap(
232
-
name = "auth_token",
233
-
long = "auth-token",
234
-
value_name = "AUTH_TOKEN",
235
-
help = "authorization token used to upload profiling data"
236
-
)]
237
-
auth_token:Option<String>,
58
+
// TODO: placeholder for future implementation
59
+
//#[clap(
60
+
//name = "auth_token",
61
+
//long = "auth-token",
62
+
//value_name = "AUTH_TOKEN",
63
+
//help = "authorization token used to upload profiling data"
64
+
//)]
65
+
//auth_token: Option<String>,
238
66
#[clap(
239
67
name = "detect_subprocesses",
240
68
long = "detect-subprocesses",
@@ -310,23 +138,24 @@ they are used to launch a new process before polling the URL.
310
138
help = "tag in key=value form. The flag may be specified multiple times"
311
139
)]
312
140
tag:Option<String>,
313
-
#[clap(
314
-
name = "upstream_request_timeout",
315
-
long = "upstream-request-timeout",
316
-
value_name = "UPSTREAM_REQUEST_TIMEOUT",
317
-
help = "profile upload timeout",
318
-
default_value = "10s"
319
-
)]
320
-
upstream_request_timeout:String,
321
-
#[clap(
322
-
name = "upstream_threads",
323
-
long = "upstream-threads",
324
-
value_name = "UPSTREAM_THREADS",
325
-
help = "number of upload threads",
326
-
parse(try_from_str),
327
-
default_value = "4"
328
-
)]
329
-
upstream_threads:u32,
141
+
// TODO: placeholder for future implementation
142
+
//#[clap(
143
+
//name = "upstream_request_timeout",
144
+
//long = "upstream-request-timeout",
145
+
//value_name = "UPSTREAM_REQUEST_TIMEOUT",
146
+
//help = "profile upload timeout",
147
+
//default_value = "10s"
148
+
//)]
149
+
//upstream_request_timeout: String,
150
+
//#[clap(
151
+
//name = "upstream_threads",
152
+
//long = "upstream-threads",
153
+
//value_name = "UPSTREAM_THREADS",
154
+
//help = "number of upload threads",
155
+
//parse(try_from_str),
156
+
//default_value = "4"
157
+
//)]
158
+
//upstream_threads: u32,
330
159
},
331
160
#[clap(
332
161
name = "exec",
@@ -344,12 +173,13 @@ they are used to launch a new process before polling the URL.
344
173
help = "application name used when uploading profiling data"
345
174
)]
346
175
application_name:Option<String>,
347
-
#[clap(
348
-
name = "auth_token",
349
-
long = "auth-token",
350
-
value_name = "AUTH_TOKEN",
351
-
help = "authorization token used to upload profiling data"
352
-
)]
176
+
// TODO: placeholder for future implementation
177
+
//#[clap(
178
+
//name = "auth_token",
179
+
//long = "auth-token",
180
+
//value_name = "AUTH_TOKEN",
181
+
//help = "authorization token used to upload profiling data"
182
+
//)]
353
183
auth_token:Option<String>,
354
184
#[clap(
355
185
name = "detect_subprocesses",
@@ -432,23 +262,24 @@ they are used to launch a new process before polling the URL.
432
262
help = "tag in key=value form. The flag may be specified multiple times"
0 commit comments