Support Async Profiler Feature#203
Conversation
|
@mrproliu We don't have backend ready, as we need this to verify the backend. Please review from codes as much as possible. |
|
@zhengziyi0117 Please fix CI. |
| var Command = &cli.Command{ | ||
| Name: "asyncprofiler", | ||
| Usage: "async profiler related sub-command", | ||
| UsageText: `todo`, |
There was a problem hiding this comment.
Please update the usage text.
| ) | ||
|
|
||
| var Command = &cli.Command{ | ||
| Name: "asyncprofiler", |
There was a problem hiding this comment.
If this command is under the profiling command, should we remove the profiler suffix?
For now, the command should be: swctl profiling asyncprofiler, I think it could be: swctl profiling async is much clear, what do you think?
| eventTypes = append(eventTypes, query.AsyncProfilerEventType(upperCaseEvent)) | ||
| } | ||
|
|
||
| execArgs := ctx.String("exec-args") |
There was a problem hiding this comment.
Should we make the type of execArgs as *string, and assign the value when judgment the ctx.String is not an empty string? You will get an empty string even if the exec-args is not declared.
| eventTypes := make([]query.AsyncProfilerEventType, 0) | ||
| for _, event := range events { | ||
| upperCaseEvent := strings.ToUpper(event) | ||
| eventTypes = append(eventTypes, query.AsyncProfilerEventType(upperCaseEvent)) | ||
| } |
There was a problem hiding this comment.
It is best to create an enum model to obtain the event types, and the CLI should verify whether we have an enum value. You can refer to https://github.com/apache/skywalking-cli/blob/master/internal/model/type.go. However, the type you choose should be a slice, which is slightly different from the existing reference.
| &cli.StringFlag{ | ||
| Name: "event", | ||
| Usage: "which event types this task needs to collect.", | ||
| Required: true, | ||
| }, |
There was a problem hiding this comment.
The enum should be a new model. Instant of a string value without any type check.
|
|
||
| request := &query.AsyncProfilerAnalyzationRequest{ | ||
| TaskID: ctx.String("task-id"), | ||
| InstanceIds: ctx.StringSlice("service-instance-ids"), |
There was a problem hiding this comment.
Please use String and split by self.
| startTime := ctx.Int64("start-time") | ||
| endTime := ctx.Int64("end-time") | ||
| limit := ctx.Int("limit") |
There was a problem hiding this comment.
Let us declare the startTime, endTime, and limit as *int64 or *int first, otherwise the value will be 0.
|
|
||
| var getTaskProgressCommand = &cli.Command{ | ||
| Name: "progress", | ||
| Aliases: []string{"logs", "p"}, |
There was a problem hiding this comment.
Can it be used as swctl profiling asyncprofiler logs? I think it's a difference in the meaning of progress.
|
@zhengziyi0117 Also, please update the CHANGES.md |
Co-authored-by: mrproliu <741550557@qq.com>
Co-authored-by: mrproliu <741550557@qq.com>
Co-authored-by: mrproliu <741550557@qq.com>
|
Pls run golangci-lint locally to ensure it can pass CI |
| instanceNameFlagName = "instance-name" | ||
| destInstanceIDFlagName = "dest-instance-id" | ||
| destInstanceNameFlagName = "dest-instance-name" | ||
| InstanceIDSliceFlagName = "instance-id-slice" |
There was a problem hiding this comment.
We usually use "list" instant of "slice"
| Examples: | ||
| 1. Query the flame graph produced by async-profiler | ||
| $ swctl profiling async analysis --service-name=service-name --task-id=task-id \ | ||
| --service-instance-ids=instance-name1,instance-name2 --event=execution_sample`, |
There was a problem hiding this comment.
Please update all incorrect name of the parameter.
|
Could you update the PR description to add which commands are you adding, and put some examples(input and output) in it? |
Add the sub-command
profiling asyncfor async-profiler query APIHere are some examples