From 2ada9e14fa07a0fb13f17909790d0c12a739c18b Mon Sep 17 00:00:00 2001 From: mrproliu <741550557@qq.com> Date: Thu, 18 Sep 2025 09:36:45 +0800 Subject: [PATCH 1/4] Adapt the new trace v2 query protocol --- CHANGES.md | 3 + assets/graphqls/trace/ColdTrace.graphql | 66 ----------- assets/graphqls/trace/Trace.graphql | 4 +- assets/graphqls/tracev2/Traces.graphql | 71 +++++++++++ cmd/swctl/main.go | 2 + internal/commands/trace/list.go | 8 -- internal/commands/trace/trace.go | 28 ++++- internal/commands/tracev2/list.go | 150 ++++++++++++++++++++++++ internal/commands/tracev2/tracev2.go | 29 +++++ pkg/display/graph/tree/list.go | 8 +- pkg/graphql/trace/trace.go | 14 +-- pkg/graphql/tracev2/trace.go | 40 +++++++ 12 files changed, 330 insertions(+), 93 deletions(-) delete mode 100644 assets/graphqls/trace/ColdTrace.graphql create mode 100644 assets/graphqls/tracev2/Traces.graphql create mode 100644 internal/commands/tracev2/list.go create mode 100644 internal/commands/tracev2/tracev2.go create mode 100644 pkg/graphql/tracev2/trace.go diff --git a/CHANGES.md b/CHANGES.md index 70bed05b..4ae94b86 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,9 @@ Release Notes. * Add the sub-command `alarm autocomplete-keys` and `alarm auto-complete-values` for alarm query API by @mrproliu in https://github.com/apache/skywalking-cli/pull/210 * Adapt the alarm message query API by @mrproliu in https://github.com/apache/skywalking-cli/pull/210 * Add the owner field in the `metrics exec` query API by @mrproliu in https://github.com/apache/skywalking-cli/pull/210 +* Add the `trace-v2 list` command for adapt the new trace query API by @mrproliu in https://github.com/apache/skywalking-cli/pull/225 +* Add the duration field in the `trace list` command by @mrproliu in https://github.com/apache/skywalking-cli/pull/225 +* Remove the oldest `queryTraceFromColdStage` query call in the `trace list` command by @mrproliu in https://github.com/apache/skywalking-cli/pull/225 ### Bug Fixes diff --git a/assets/graphqls/trace/ColdTrace.graphql b/assets/graphqls/trace/ColdTrace.graphql deleted file mode 100644 index eb53ef7c..00000000 --- a/assets/graphqls/trace/ColdTrace.graphql +++ /dev/null @@ -1,66 +0,0 @@ -# Licensed to Apache Software Foundation (ASF) under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Apache Software Foundation (ASF) licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -query ($traceId: ID!, $duration: Duration!) { - result: queryTraceFromColdStage(traceId: $traceId, duration: $duration) { - spans { - traceId - segmentId - spanId - parentSpanId - refs { - traceId - parentSegmentId - parentSpanId - type - } - serviceCode - serviceInstanceName - startTime - endTime - endpointName - type - peer - component - isError - layer - tags { - key value - } - logs { - time data { - key value - } - } - attachedEvents { - startTime { - seconds nanos - } - event - endTime { - seconds nanos - } - tags { - key value - } - summary { - key value - } - } - } - } -} diff --git a/assets/graphqls/trace/Trace.graphql b/assets/graphqls/trace/Trace.graphql index 8f52c019..156352fe 100644 --- a/assets/graphqls/trace/Trace.graphql +++ b/assets/graphqls/trace/Trace.graphql @@ -15,8 +15,8 @@ # specific language governing permissions and limitations # under the License. -query ($traceId: ID!) { - result: queryTrace(traceId: $traceId) { +query ($traceId: ID!, $duration: Duration) { + result: queryTrace(traceId: $traceId, duration: $duration) { spans { traceId segmentId diff --git a/assets/graphqls/tracev2/Traces.graphql b/assets/graphqls/tracev2/Traces.graphql new file mode 100644 index 00000000..058b7955 --- /dev/null +++ b/assets/graphqls/tracev2/Traces.graphql @@ -0,0 +1,71 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +query ($condition: TraceQueryCondition){ + result: queryTraces(condition: $condition){ + traces { + spans { + traceId + segmentId + spanId + parentSpanId + refs { + traceId + parentSegmentId + parentSpanId + type + } + serviceCode + serviceInstanceName + startTime + endTime + endpointName + type + peer + component + isError + layer + tags { + key value + } + logs { + time data { + key value + } + } + attachedEvents { + startTime { + seconds nanos + } + event + endTime { + seconds nanos + } + tags { + key value + } + summary { + key value + } + } + } + } + retrievedTimeRange { + startTime endTime + } + } +} \ No newline at end of file diff --git a/cmd/swctl/main.go b/cmd/swctl/main.go index 81914fac..6a298838 100644 --- a/cmd/swctl/main.go +++ b/cmd/swctl/main.go @@ -43,6 +43,7 @@ import ( "github.com/apache/skywalking-cli/internal/commands/records" "github.com/apache/skywalking-cli/internal/commands/service" "github.com/apache/skywalking-cli/internal/commands/trace" + "github.com/apache/skywalking-cli/internal/commands/tracev2" intutil "github.com/apache/skywalking-cli/internal/util" "github.com/apache/skywalking-cli/pkg/logger" "github.com/apache/skywalking-cli/pkg/util" @@ -99,6 +100,7 @@ services, service instances, etc.` service.Command, metrics.Command, trace.Command, + tracev2.Command, healthcheck.Command, dashboard.Command, install.Command, diff --git a/internal/commands/trace/list.go b/internal/commands/trace/list.go index fe738cc9..ac20ed57 100644 --- a/internal/commands/trace/list.go +++ b/internal/commands/trace/list.go @@ -102,14 +102,6 @@ $ swctl trace ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d" --cold traceID := ctx.String("trace-id") tagStr := ctx.String("tags") - if coldStage && traceID != "" { - trace, err := trace.ColdTrace(ctx.Context, duration, traceID) - if err != nil { - return err - } - return display.Display(ctx.Context, &displayable.Displayable{Data: trace}) - } - var tags []*api.SpanTag = nil if tagStr != "" { tagArr := strings.SplitSeq(tagStr, ",") diff --git a/internal/commands/trace/trace.go b/internal/commands/trace/trace.go index f7f31a09..25b7df5f 100644 --- a/internal/commands/trace/trace.go +++ b/internal/commands/trace/trace.go @@ -22,6 +22,11 @@ import ( "github.com/urfave/cli/v2" + api "skywalking.apache.org/repo/goapi/query" + + "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/trace" @@ -39,12 +44,33 @@ with specified options, like service name, endpoint name, etc. Examples: 1. Query the trace details (spans) of id "321661b1-9a31-4e12-ad64-c8f6711f108d": $ swctl trace "321661b1-9a31-4e12-ad64-c8f6711f108d"`, + Flags: flags.Flags(flags.DurationFlags), Action: func(ctx *cli.Context) error { if ctx.NArg() == 0 { return fmt.Errorf("command trace without sub command requires 1 trace id as argument") } - trace, err := trace.Trace(ctx.Context, ctx.Args().First()) + // if the user has set start or end, then we use the duration + var duration *api.Duration + start := ctx.String("start") + end := ctx.String("end") + if start != "" || end != "" { + if err := interceptor.DurationInterceptor(ctx); err != nil { + return err + } + step := ctx.Generic("step") + coldStage := ctx.Bool("cold") + start = ctx.String("start") + end = ctx.String("end") + duration = &api.Duration{ + Start: start, + End: end, + Step: step.(*model.StepEnumValue).Selected, + ColdStage: &coldStage, + } + } + + trace, err := trace.Trace(ctx.Context, duration, ctx.Args().First()) if err != nil { return err } diff --git a/internal/commands/tracev2/list.go b/internal/commands/tracev2/list.go new file mode 100644 index 00000000..0c1faf06 --- /dev/null +++ b/internal/commands/tracev2/list.go @@ -0,0 +1,150 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package tracev2 + +import ( + "fmt" + "strings" + + api "skywalking.apache.org/repo/goapi/query" + + "github.com/urfave/cli/v2" + + "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/tracev2" +) + +const DefaultPageSize = 15 + +var ListCommand = &cli.Command{ + Name: "list", + Aliases: []string{"ls"}, + Usage: "Query the monitored traces", + UsageText: `Query the monitored traces. + +Examples: +1. Query all monitored traces: +$ swctl trace-v2 ls + +2. Query all monitored traces of service "business-zone::projectB": +$ swctl trace-v2 ls --service-name "business-zone::projectB" + +3. Query all monitored traces of endpoint "/projectB/{value}" of service "business-zone::projectB": +$ swctl trace-v2 ls --service-name "business-zone::projectB" --endpoint-name "/projectB/{value}" + +3. Query the monitored trace of id "321661b1-9a31-4e12-ad64-c8f6711f108d": +$ swctl trace-v2 ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d" + +4. Query the monitored trace of id "321661b1-9a31-4e12-ad64-c8f6711f108d" from cold-stage storage: +$ swctl trace-v2 ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d" --cold +`, + Flags: flags.Flags( + flags.DurationFlags, + flags.InstanceFlags, + flags.EndpointFlags, + []cli.Flag{ + &cli.StringFlag{ + Name: "trace-id", + Usage: "`id` of the trace", + Required: false, + }, + &cli.StringFlag{ + Name: "tags", + Usage: "`tags` of the trace, in form of `key=value,key=value`", + Required: false, + }, + &cli.StringFlag{ + Name: "order", + Usage: "`order` of the returned traces, can be `duration` or `startTime`", + Value: "duration", + }, + }, + ), + Before: interceptor.BeforeChain( + interceptor.DurationInterceptor, + interceptor.ParseInstance(false), + interceptor.ParseEndpoint(false), + ), + Action: func(ctx *cli.Context) error { + start := ctx.String("start") + end := ctx.String("end") + step := ctx.Generic("step") + coldStage := ctx.Bool("cold") + + duration := api.Duration{ + Start: start, + End: end, + Step: step.(*model.StepEnumValue).Selected, + ColdStage: &coldStage, + } + serviceID := ctx.String("service-id") + endpointID := ctx.String("endpoint-id") + serviceInstanceID := ctx.String("instance-id") + traceID := ctx.String("trace-id") + tagStr := ctx.String("tags") + + var tags []*api.SpanTag = nil + if tagStr != "" { + tagArr := strings.SplitSeq(tagStr, ",") + for tag := range tagArr { + kv := strings.Split(tag, "=") + tags = append(tags, &api.SpanTag{Key: kv[0], Value: &kv[1]}) + } + } + pageNum := 1 + + paging := api.Pagination{ + PageNum: &pageNum, + PageSize: DefaultPageSize, + } + + var order api.QueryOrder + switch orderStr := ctx.String("order"); orderStr { + case "duration": + order = api.QueryOrderByDuration + case "startTime": + order = api.QueryOrderByStartTime + default: + return fmt.Errorf(`invalid order %v, must be one of "duration" or "startTime"`, orderStr) + } + + condition := &api.TraceQueryCondition{ + ServiceID: &serviceID, + ServiceInstanceID: &serviceInstanceID, + TraceID: &traceID, + EndpointID: &endpointID, + QueryDuration: &duration, + MinTraceDuration: nil, + MaxTraceDuration: nil, + TraceState: api.TraceStateAll, + QueryOrder: order, + Tags: tags, + Paging: &paging, + } + traces, err := tracev2.Traces(ctx.Context, condition) + if err != nil { + return err + } + + return display.Display(ctx.Context, &displayable.Displayable{Data: traces, Condition: condition}) + }, +} diff --git a/internal/commands/tracev2/tracev2.go b/internal/commands/tracev2/tracev2.go new file mode 100644 index 00000000..f8269669 --- /dev/null +++ b/internal/commands/tracev2/tracev2.go @@ -0,0 +1,29 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package tracev2 + +import "github.com/urfave/cli/v2" + +var Command = &cli.Command{ + Name: "trace-v2", + Aliases: []string{"tv2"}, + Usage: "Trace v2 related sub-command", + Subcommands: cli.Commands{ + ListCommand, + }, +} diff --git a/pkg/display/graph/tree/list.go b/pkg/display/graph/tree/list.go index daf9dc1e..7ff12089 100644 --- a/pkg/display/graph/tree/list.go +++ b/pkg/display/graph/tree/list.go @@ -93,7 +93,7 @@ func DisplayList(ctx context.Context, displayable *d.Displayable) error { } func draw(ctx context.Context, list *widgets.List, tree *widgets.Tree, detail, help *widgets.Paragraph, data api.TraceBrief, - _ *api.TraceQueryCondition, + condition *api.TraceQueryCondition, ) { x, y := ui.TerminalDimensions() @@ -101,7 +101,7 @@ func draw(ctx context.Context, list *widgets.List, tree *widgets.Tree, detail, h showIndex := list.SelectedRow traceID := data.Traces[showIndex].TraceIds[0] list.Title = fmt.Sprintf("[%s]", traceID) - nodes, serviceNames := getNodeData(ctx, traceID) + nodes, serviceNames := getNodeData(ctx, traceID, condition.QueryDuration) tree.Title = fmt.Sprintf("[%s]", strings.Join(serviceNames, "->")) tree.SetNodes(nodes) list.Rows = rows(data, x/4) @@ -202,8 +202,8 @@ func listActions(key string, list *widgets.List, tree *widgets.Tree, listActive return f } -func getNodeData(ctx context.Context, traceID string) (nodes []*widgets.TreeNode, serviceNames []string) { - data, err := trace.Trace(ctx, traceID) +func getNodeData(ctx context.Context, traceID string, duration *api.Duration) (nodes []*widgets.TreeNode, serviceNames []string) { + data, err := trace.Trace(ctx, duration, traceID) if err != nil { logger.Log.Fatalln(err) } diff --git a/pkg/graphql/trace/trace.go b/pkg/graphql/trace/trace.go index fa6669e4..c6f9e0c8 100644 --- a/pkg/graphql/trace/trace.go +++ b/pkg/graphql/trace/trace.go @@ -28,23 +28,13 @@ import ( "github.com/apache/skywalking-cli/pkg/graphql/client" ) -func Trace(ctx context.Context, traceID string) (api.Trace, error) { +func Trace(ctx context.Context, duration *api.Duration, traceID string) (api.Trace, error) { var response map[string]api.Trace request := graphql.NewRequest(assets.Read("graphqls/trace/Trace.graphql")) request.Var("traceId", traceID) - - err := client.ExecuteQuery(ctx, request, &response) - - return response["result"], err -} - -func ColdTrace(ctx context.Context, duration api.Duration, traceID string) (api.Trace, error) { - var response map[string]api.Trace - - request := graphql.NewRequest(assets.Read("graphqls/trace/ColdTrace.graphql")) - request.Var("traceId", traceID) request.Var("duration", duration) + err := client.ExecuteQuery(ctx, request, &response) return response["result"], err diff --git a/pkg/graphql/tracev2/trace.go b/pkg/graphql/tracev2/trace.go new file mode 100644 index 00000000..fbcef0da --- /dev/null +++ b/pkg/graphql/tracev2/trace.go @@ -0,0 +1,40 @@ +// Licensed to Apache Software Foundation (ASF) under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Apache Software Foundation (ASF) licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package tracev2 + +import ( + "context" + + "github.com/machinebox/graphql" + + api "skywalking.apache.org/repo/goapi/query" + + "github.com/apache/skywalking-cli/assets" + "github.com/apache/skywalking-cli/pkg/graphql/client" +) + +func Traces(ctx context.Context, condition *api.TraceQueryCondition) (api.TraceBrief, error) { + var response map[string]api.TraceBrief + + request := graphql.NewRequest(assets.Read("graphqls/tracev2/Traces.graphql")) + request.Var("condition", condition) + + err := client.ExecuteQuery(ctx, request, &response) + + return response["result"], err +} From 01b97cfc4a22078909c36a4ed4dd942178507436 Mon Sep 17 00:00:00 2001 From: mrproliu <741550557@qq.com> Date: Thu, 18 Sep 2025 10:04:30 +0800 Subject: [PATCH 2/4] fix CI --- .../trace/TraceWithoutDuration.graphql | 66 +++++++++++++++++++ pkg/graphql/trace/trace.go | 11 +++- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 assets/graphqls/trace/TraceWithoutDuration.graphql diff --git a/assets/graphqls/trace/TraceWithoutDuration.graphql b/assets/graphqls/trace/TraceWithoutDuration.graphql new file mode 100644 index 00000000..8f52c019 --- /dev/null +++ b/assets/graphqls/trace/TraceWithoutDuration.graphql @@ -0,0 +1,66 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you under +# the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +query ($traceId: ID!) { + result: queryTrace(traceId: $traceId) { + spans { + traceId + segmentId + spanId + parentSpanId + refs { + traceId + parentSegmentId + parentSpanId + type + } + serviceCode + serviceInstanceName + startTime + endTime + endpointName + type + peer + component + isError + layer + tags { + key value + } + logs { + time data { + key value + } + } + attachedEvents { + startTime { + seconds nanos + } + event + endTime { + seconds nanos + } + tags { + key value + } + summary { + key value + } + } + } + } +} diff --git a/pkg/graphql/trace/trace.go b/pkg/graphql/trace/trace.go index c6f9e0c8..49aac4fe 100644 --- a/pkg/graphql/trace/trace.go +++ b/pkg/graphql/trace/trace.go @@ -31,9 +31,16 @@ import ( func Trace(ctx context.Context, duration *api.Duration, traceID string) (api.Trace, error) { var response map[string]api.Trace - request := graphql.NewRequest(assets.Read("graphqls/trace/Trace.graphql")) + graphQLFile := "graphqls/trace/Trace.graphql" + if duration == nil { + graphQLFile = "graphqls/trace/TraceWithoutDuration.graphql" + } + + request := graphql.NewRequest(assets.Read(graphQLFile)) request.Var("traceId", traceID) - request.Var("duration", duration) + if duration != nil { + request.Var("duration", duration) + } err := client.ExecuteQuery(ctx, request, &response) From 5ef034a2b5297d13adb2db2cac4a9ee01dfba52f Mon Sep 17 00:00:00 2001 From: mrproliu <741550557@qq.com> Date: Thu, 18 Sep 2025 10:44:52 +0800 Subject: [PATCH 3/4] fix response data --- go.mod | 4 ++-- go.sum | 28 ++++++++++++++-------------- pkg/graphql/tracev2/trace.go | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 92d07388..6a22c669 100644 --- a/go.mod +++ b/go.mod @@ -14,11 +14,11 @@ require ( github.com/spf13/viper v1.7.0 github.com/urfave/cli/v2 v2.3.0 golang.org/x/text v0.25.0 - google.golang.org/grpc v1.72.0 + google.golang.org/grpc v1.73.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/apimachinery v0.33.1 sigs.k8s.io/controller-runtime v0.20.4 - skywalking.apache.org/repo/goapi v0.0.0-20250516073621-c1d2fb980695 + skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc ) require ( diff --git a/go.sum b/go.sum index 77111d71..6587f3fa 100644 --- a/go.sum +++ b/go.sum @@ -326,16 +326,16 @@ go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= -go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= -go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= -go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= -go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= -go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= -go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= -go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= -go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= -go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ= +go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y= +go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M= +go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE= +go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= +go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= +go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= +go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= +go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs= +go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= @@ -487,8 +487,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2/go. google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.72.0 h1:S7UkcVa60b5AAQTaO6ZKamFp1zMZSU0fGDK2WZLbBnM= -google.golang.org/grpc v1.72.0/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok= +google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -543,5 +543,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.7.0 h1:qPeWmscJcXP0snki5IYF79Z8xrl8ETFxg sigs.k8s.io/structured-merge-diff/v4 v4.7.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= -skywalking.apache.org/repo/goapi v0.0.0-20250516073621-c1d2fb980695 h1:ED9fRO1rV5K3Kr5HQa1pQ87/xtXBmjYvT1EQfQ1VV3Y= -skywalking.apache.org/repo/goapi v0.0.0-20250516073621-c1d2fb980695/go.mod h1:rTNGn2QrS+p1i2OaIBxlwQ/VrDSDc7OwRk/iWV+mU0k= +skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc h1:HhlLDl0aOIgiIdJl9p0a7PHHdZbs9epKEnewB7AWdZs= +skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc/go.mod h1:Vj9vINJYsTQASPsbQ1i81YgH8nFC/Xds4GjcXvmRYwM= diff --git a/pkg/graphql/tracev2/trace.go b/pkg/graphql/tracev2/trace.go index fbcef0da..386f3f7e 100644 --- a/pkg/graphql/tracev2/trace.go +++ b/pkg/graphql/tracev2/trace.go @@ -28,8 +28,8 @@ import ( "github.com/apache/skywalking-cli/pkg/graphql/client" ) -func Traces(ctx context.Context, condition *api.TraceQueryCondition) (api.TraceBrief, error) { - var response map[string]api.TraceBrief +func Traces(ctx context.Context, condition *api.TraceQueryCondition) (api.TraceList, error) { + var response map[string]api.TraceList request := graphql.NewRequest(assets.Read("graphqls/tracev2/Traces.graphql")) request.Var("condition", condition) From 603eebbd7f7492efcf388c7a10eb5518a5c2a16b Mon Sep 17 00:00:00 2001 From: mrproliu <741550557@qq.com> Date: Thu, 18 Sep 2025 10:48:07 +0800 Subject: [PATCH 4/4] fix header --- dist/LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/LICENSE b/dist/LICENSE index 808954d4..e88d41e3 100644 --- a/dist/LICENSE +++ b/dist/LICENSE @@ -200,7 +200,7 @@ The text of each license is also included at licenses/license-[project].txt. github.com/spf13/afero v1.2.2 Apache-2.0 gomodules.xyz/jsonpatch/v2 v2.5.0 Apache-2.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 Apache-2.0 - google.golang.org/grpc v1.72.0 Apache-2.0 + google.golang.org/grpc v1.73.0 Apache-2.0 gopkg.in/ini.v1 v1.51.0 Apache-2.0 gopkg.in/yaml.v2 v2.4.0 Apache-2.0 k8s.io/api v0.33.1 Apache-2.0 @@ -213,7 +213,7 @@ The text of each license is also included at licenses/license-[project].txt. sigs.k8s.io/controller-runtime v0.20.4 Apache-2.0 sigs.k8s.io/randfill v1.0.0 Apache-2.0 sigs.k8s.io/structured-merge-diff/v4 v4.7.0 Apache-2.0 - skywalking.apache.org/repo/goapi v0.0.0-20250516073621-c1d2fb980695 Apache-2.0 + skywalking.apache.org/repo/goapi v0.0.0-20250918024206-7be91673cadc Apache-2.0 ======================================================================== Apache-2.0 and BSD-3-Clause licenses