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

Remove total field in trace list and logs list commands #152

Merged
merged 2 commits into from
May 18, 2022
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release Notes.
- Update the `process list` to must be provided the instance and duration.(#144)
- Remove `layer` field in the `instance` and `process` commands for 9.1.0 GraphQL query protocol's breaking changes (#149)
- Remove `duration` flag in `profiling ebpf schedules`.(#150)
- [Breaking Change] Remove `total` field in `trace list` and `logs list` commands.(#152)

0.10.0
------------------
Expand Down
1 change: 0 additions & 1 deletion assets/graphqls/logs/Logs.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

query ($condition: LogQueryCondition!) {
result: queryLogs(condition: $condition) {
total
logs {
serviceName
serviceId
Expand Down
1 change: 0 additions & 1 deletion assets/graphqls/trace/Traces.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

query ($condition: TraceQueryCondition!){
result: queryBasicTraces(condition: $condition){
total
traces {
segmentId
endpointNames
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ require (
gopkg.in/yaml.v2 v2.4.0
k8s.io/apimachinery v0.21.1
sigs.k8s.io/controller-runtime v0.7.0
skywalking.apache.org/repo/goapi v0.0.0-20220510085451-6911e2f4c612
skywalking.apache.org/repo/goapi v0.0.0-20220518085432-c95731d312d2
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -950,5 +950,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
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-20220510085451-6911e2f4c612 h1:nj/UGfpda0FbFJNoRDQYwuXEdlUJWPJFNxxKJyHcync=
skywalking.apache.org/repo/goapi v0.0.0-20220510085451-6911e2f4c612/go.mod h1:uWwwvhcwe2MD/nJCg0c1EE/eL6KzaBosLHDfMFoEJ30=
skywalking.apache.org/repo/goapi v0.0.0-20220518085432-c95731d312d2 h1:ejZ7/AVl5/hQn9WEsNSJm1OU/nI6YZwmTVEosW9Ij7U=
skywalking.apache.org/repo/goapi v0.0.0-20220518085432-c95731d312d2/go.mod h1:uWwwvhcwe2MD/nJCg0c1EE/eL6KzaBosLHDfMFoEJ30=
6 changes: 2 additions & 4 deletions internal/commands/alarm/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ $ swctl alarm list
}

pageNum := 1
needTotal := true
paging := api.Pagination{
PageNum: &pageNum,
PageSize: DefaultPageSize,
NeedTotal: &needTotal,
PageNum: &pageNum,
PageSize: DefaultPageSize,
}

condition := &alarm.ListAlarmCondition{
Expand Down
6 changes: 2 additions & 4 deletions internal/commands/browser/logs/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ $ swctl browser logs list`,
pageID := ctx.String("page-id")

pageNum := 1
needTotal := true

paging := api.Pagination{
PageNum: &pageNum,
PageSize: DefaultPageSize,
NeedTotal: &needTotal,
PageNum: &pageNum,
PageSize: DefaultPageSize,
}
condition := &api.BrowserErrorLogQueryCondition{
ServiceID: &serviceID,
Expand Down
6 changes: 2 additions & 4 deletions internal/commands/event/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@ $ swctl event list
eventType := api.EventType(ctx.Generic("type").(*model.EventTypeEnumValue).String())
layer := strings.ToUpper(ctx.String("layer"))
pageNum := 1
needTotal := true

paging := api.Pagination{
PageNum: &pageNum,
PageSize: DefaultPageSize,
NeedTotal: &needTotal,
PageNum: &pageNum,
PageSize: DefaultPageSize,
}
condition := &api.EventQueryCondition{
Source: &api.SourceInput{
Expand Down
6 changes: 2 additions & 4 deletions internal/commands/logs/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ $ swctl logs list --trace-id 3d56f33f-bcd3-4e40-9e4f-5dc547998ef5`,
endpointID := ctx.String("endpoint-id")
traceID := ctx.String("trace-id")
pageNum := 1
needTotal := true

tagStr := ctx.String("tags")
var tags []*api.LogTag = nil
Expand All @@ -96,9 +95,8 @@ $ swctl logs list --trace-id 3d56f33f-bcd3-4e40-9e4f-5dc547998ef5`,
}

paging := api.Pagination{
PageNum: &pageNum,
PageSize: DefaultPageSize,
NeedTotal: &needTotal,
PageNum: &pageNum,
PageSize: DefaultPageSize,
}

condition := &api.LogQueryCondition{
Expand Down
6 changes: 2 additions & 4 deletions internal/commands/trace/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,10 @@ $ swctl trace ls --trace-id "321661b1-9a31-4e12-ad64-c8f6711f108d"
}
}
pageNum := 1
needTotal := true

paging := api.Pagination{
PageNum: &pageNum,
PageSize: DefaultPageSize,
NeedTotal: &needTotal,
PageNum: &pageNum,
PageSize: DefaultPageSize,
}

var order api.QueryOrder
Expand Down
24 changes: 8 additions & 16 deletions pkg/display/graph/tree/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ func DisplayList(ctx *cli.Context, displayable *d.Displayable) error {
}

func draw(list *widgets.List, tree *widgets.Tree, detail, help *widgets.Paragraph, data api.TraceBrief,
ctx *cli.Context, condition *api.TraceQueryCondition) {
ctx *cli.Context, _ *api.TraceQueryCondition) {
x, y := ui.TerminalDimensions()

if data.Total != 0 {
if len(data.Traces) != 0 {
showIndex := list.SelectedRow
var traceID = data.Traces[showIndex].TraceIds[0]
list.Title = fmt.Sprintf("[ %d/%d %s]", *condition.Paging.PageNum, totalPages(data.Total), traceID)
list.Title = fmt.Sprintf("[%s]", traceID)
nodes, serviceNames := getNodeData(ctx, traceID)
tree.Title = fmt.Sprintf("[%s]", strings.Join(serviceNames, "->"))
tree.SetNodes(nodes)
Expand All @@ -118,12 +118,6 @@ func draw(list *widgets.List, tree *widgets.Tree, detail, help *widgets.Paragrap
tree.ExpandAll()
ui.Render(list, tree, detail, help)
}
func totalPages(total int) int {
if total%DefaultPageSize == 0 {
return total / DefaultPageSize
}
return total/DefaultPageSize + 1
}

func listenTracesKeyboard(list *widgets.List, tree *widgets.Tree, data api.TraceBrief, ctx *cli.Context,
detail, help *widgets.Paragraph, condition *api.TraceQueryCondition) {
Expand All @@ -149,13 +143,11 @@ func listenTracesKeyboard(list *widgets.List, tree *widgets.Tree, data api.Trace
tree.SelectedRow = 0
case "<C-f>", "n":
pageNum := *condition.Paging.PageNum
if pageNum < totalPages(data.Total) {
pageNum++
condition.Paging.PageNum = &pageNum
data, err = trace.Traces(ctx, condition)
if err != nil {
logger.Log.Fatalln(err)
}
pageNum++
condition.Paging.PageNum = &pageNum
data, err = trace.Traces(ctx, condition)
if err != nil {
logger.Log.Fatalln(err)
}
tree.SelectedRow = 0
case "<Right>":
Expand Down
1 change: 0 additions & 1 deletion test/cases/8.8.1/expected/traces-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ traces:
traceids:
- {{ index .traceids 0 }}
{{- end }}
total: {{ gt .total 0 }}
1 change: 0 additions & 1 deletion test/cases/9.0.0/expected/traces-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ traces:
traceids:
- {{ index .traceids 0 }}
{{- end }}
total: {{ gt .total 0 }}