@@ -23,6 +23,7 @@ import (
2323
2424 "github.com/apache/skywalking-cli/internal/commands/interceptor"
2525 "github.com/apache/skywalking-cli/internal/flags"
26+ "github.com/apache/skywalking-cli/internal/model"
2627 "github.com/apache/skywalking-cli/pkg/display"
2728 "github.com/apache/skywalking-cli/pkg/display/displayable"
2829 "github.com/apache/skywalking-cli/pkg/graphql/profiling"
@@ -39,15 +40,8 @@ Examples:
3940$ swctl profiling async list --service-name=service-name` ,
4041 Flags : flags .Flags (
4142 flags .ServiceFlags ,
43+ flags .DurationFlags ,
4244 []cli.Flag {
43- & cli.Int64Flag {
44- Name : "start-time" ,
45- Usage : "The start time (in milliseconds) of the event, measured between the current time and midnight, January 1, 1970 UTC." ,
46- },
47- & cli.Int64Flag {
48- Name : "end-time" ,
49- Usage : "The end time (in milliseconds) of the event, measured between the current time and midnight, January 1, 1970 UTC." ,
50- },
5145 & cli.IntFlag {
5246 Name : "limit" ,
5347 Usage : "Limit defines the number of the tasks to be returned." ,
@@ -56,27 +50,27 @@ $ swctl profiling async list --service-name=service-name`,
5650 ),
5751 Before : interceptor .BeforeChain (
5852 interceptor .ParseService (true ),
53+ interceptor .DurationInterceptor ,
5954 ),
6055 Action : func (ctx * cli.Context ) error {
6156 serviceID := ctx .String ("service-id" )
62- var startTime * int64
63- if startTimeArg := ctx .Int64 ( "start-time" ); startTimeArg != 0 {
64- startTime = & startTimeArg
65- }
66- var endTime * int64
67- if endTimeArg := ctx . Int64 ( "end-time" ); endTimeArg != 0 {
68- endTime = & endTimeArg
57+ start := ctx . String ( "start" )
58+ end := ctx .String ( "end" )
59+ step := ctx . Generic ( "step" )
60+ duration := query. Duration {
61+ Start : start ,
62+ End : end ,
63+ Step : step .( * model. StepEnumValue ). Selected ,
6964 }
7065 var limit * int
7166 if limitArg := ctx .Int ("limit" ); limitArg != 0 {
7267 limit = & limitArg
7368 }
7469
7570 request := & query.AsyncProfilerTaskListRequest {
76- ServiceID : serviceID ,
77- StartTime : startTime ,
78- EndTime : endTime ,
79- Limit : limit ,
71+ ServiceID : serviceID ,
72+ QueryDuration : & duration ,
73+ Limit : limit ,
8074 }
8175
8276 tasks , err := profiling .GetAsyncProfilerTaskList (ctx , request )
0 commit comments