Skip to content

Commit 6210a3b

Browse files
fix: Replace timestamps with Duration in async profiler query (#205)
1 parent bce7faa commit 6210a3b

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

dist/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ The text of each license is also included at licenses/license-[project].txt.
213213
k8s.io/utils v0.0.0-20210802155522-efc7438f0176 Apache-2.0
214214
sigs.k8s.io/controller-runtime v0.10.0 Apache-2.0
215215
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 Apache-2.0
216-
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007 Apache-2.0
216+
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8 Apache-2.0
217217

218218
========================================================================
219219
BSD-2-Clause licenses

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
gopkg.in/yaml.v2 v2.4.0
1919
k8s.io/apimachinery v0.22.1
2020
sigs.k8s.io/controller-runtime v0.10.0
21-
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007
21+
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8
2222
)
2323

2424
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -879,5 +879,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.1.2 h1:Hr/htKFmJEbtMgS/UD0N+gtgctAqz81t3
879879
sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
880880
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
881881
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
882-
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007 h1:MQU9yOZxgbs7fU145wd400/E3ES/HWoxTtTCudaCBoA=
883-
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007/go.mod h1:+n8BMuS8eRdzdnGh15ElRGBXPi0eYZSs2TKySBDmRTE=
882+
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8 h1:JkgizChUyT1mobFo2I3lI8+qsQU22i3FdxR0BSFC0uw=
883+
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8/go.mod h1:+n8BMuS8eRdzdnGh15ElRGBXPi0eYZSs2TKySBDmRTE=

internal/commands/profiling/asyncprofiler/getTaskList.go

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)