Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replace timestamps with Duration in async profiler query #205

Merged
merged 3 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ The text of each license is also included at licenses/license-[project].txt.
k8s.io/utils v0.0.0-20210802155522-efc7438f0176 Apache-2.0
sigs.k8s.io/controller-runtime v0.10.0 Apache-2.0
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 Apache-2.0
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007 Apache-2.0
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8 Apache-2.0

========================================================================
BSD-2-Clause licenses
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
gopkg.in/yaml.v2 v2.4.0
k8s.io/apimachinery v0.22.1
sigs.k8s.io/controller-runtime v0.10.0
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -879,5 +879,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.1.2 h1:Hr/htKFmJEbtMgS/UD0N+gtgctAqz81t3
sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007 h1:MQU9yOZxgbs7fU145wd400/E3ES/HWoxTtTCudaCBoA=
skywalking.apache.org/repo/goapi v0.0.0-20241023080050-2514649a8007/go.mod h1:+n8BMuS8eRdzdnGh15ElRGBXPi0eYZSs2TKySBDmRTE=
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8 h1:JkgizChUyT1mobFo2I3lI8+qsQU22i3FdxR0BSFC0uw=
skywalking.apache.org/repo/goapi v0.0.0-20241129131257-944118bb91b8/go.mod h1:+n8BMuS8eRdzdnGh15ElRGBXPi0eYZSs2TKySBDmRTE=
32 changes: 13 additions & 19 deletions internal/commands/profiling/asyncprofiler/getTaskList.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/apache/skywalking-cli/internal/commands/interceptor"
"github.com/apache/skywalking-cli/internal/flags"
"github.com/apache/skywalking-cli/internal/model"
"github.com/apache/skywalking-cli/pkg/display"
"github.com/apache/skywalking-cli/pkg/display/displayable"
"github.com/apache/skywalking-cli/pkg/graphql/profiling"
Expand All @@ -39,15 +40,8 @@ Examples:
$ swctl profiling async list --service-name=service-name`,
Flags: flags.Flags(
flags.ServiceFlags,
flags.DurationFlags,
[]cli.Flag{
&cli.Int64Flag{
Name: "start-time",
Usage: "The start time (in milliseconds) of the event, measured between the current time and midnight, January 1, 1970 UTC.",
},
&cli.Int64Flag{
Name: "end-time",
Usage: "The end time (in milliseconds) of the event, measured between the current time and midnight, January 1, 1970 UTC.",
},
&cli.IntFlag{
Name: "limit",
Usage: "Limit defines the number of the tasks to be returned.",
Expand All @@ -56,27 +50,27 @@ $ swctl profiling async list --service-name=service-name`,
),
Before: interceptor.BeforeChain(
interceptor.ParseService(true),
interceptor.DurationInterceptor,
),
Action: func(ctx *cli.Context) error {
serviceID := ctx.String("service-id")
var startTime *int64
if startTimeArg := ctx.Int64("start-time"); startTimeArg != 0 {
startTime = &startTimeArg
}
var endTime *int64
if endTimeArg := ctx.Int64("end-time"); endTimeArg != 0 {
endTime = &endTimeArg
start := ctx.String("start")
end := ctx.String("end")
step := ctx.Generic("step")
duration := query.Duration{
Start: start,
End: end,
Step: step.(*model.StepEnumValue).Selected,
}
var limit *int
if limitArg := ctx.Int("limit"); limitArg != 0 {
limit = &limitArg
}

request := &query.AsyncProfilerTaskListRequest{
ServiceID: serviceID,
StartTime: startTime,
EndTime: endTime,
Limit: limit,
ServiceID: serviceID,
QueryDuration: &duration,
Limit: limit,
}

tasks, err := profiling.GetAsyncProfilerTaskList(ctx, request)
Expand Down
Loading