You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/08/16 13:36:32 UTC

[GitHub] [skywalking-cli] alonelaval opened a new pull request #56: Add traces search

alonelaval opened a new pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56


   ![11371597572573_ pic_hd](https://user-images.githubusercontent.com/1763449/90335583-7bd2e380-e008-11ea-8b45-49644c800539.jpg)
   ![45141597584392_ pic_hd](https://user-images.githubusercontent.com/1763449/90335579-77a6c600-e008-11ea-955d-00ed03d1e474.jpg)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] kezhenxu94 commented on a change in pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56#discussion_r471501358



##########
File path: .gitmodules
##########
@@ -1,3 +1,4 @@
 [submodule "query-protocol"]
 	path = query-protocol
 	url = http://github.com/apache/skywalking-query-protocol/
+    branch = master

Review comment:
       > I haven't used submodules, ci errors, keep trying.
   
   This should be reverted, it doesn't fix the CI, see my changes above




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] kezhenxu94 merged pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
kezhenxu94 merged pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] kezhenxu94 commented on a change in pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56#discussion_r471929804



##########
File path: display/graph/tree/list.go
##########
@@ -0,0 +1,190 @@
+// 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 tree
+
+import (
+	"fmt"
+	"strings"
+
+	d "github.com/apache/skywalking-cli/display/displayable"
+	"github.com/apache/skywalking-cli/graphql/schema"
+	"github.com/apache/skywalking-cli/graphql/trace"
+
+	ui "github.com/gizak/termui/v3"
+	"github.com/gizak/termui/v3/widgets"
+	"github.com/urfave/cli"
+
+	"github.com/apache/skywalking-cli/logger"
+)
+
+const DefaultPageSize = 15
+const keymap = " Keymap "
+const cc = "<C-c>"
+
+func DisplayList(ctx *cli.Context, displayable *d.Displayable) error {
+	data := displayable.Data.(schema.TraceBrief)
+	condition := displayable.Condition.(*schema.TraceQueryCondition)
+	if err := ui.Init(); err != nil {
+		logger.Log.Fatalf("failed to initialize termui: %v", err)
+	}
+	defer ui.Close()
+
+	list := widgets.NewList()
+	list.TitleStyle.Fg = ui.ColorRed
+	list.TextStyle = ui.NewStyle(ui.ColorYellow)
+	list.WrapText = false
+
+	tree := widgets.NewTree()
+	tree.TextStyle = ui.NewStyle(ui.ColorYellow)
+	tree.WrapText = false
+	tree.TitleStyle.Fg = ui.ColorRed
+
+	help := widgets.NewParagraph()
+	help.WrapText = false
+	help.Title = keymap
+	help.Text = `[k          ](fg:red,mod:bold) Scroll Up
+		[<Up>       ](fg:red,mod:bold) Scroll Up
+		[j          ](fg:red,mod:bold) Scroll Down
+		[<Down>     ](fg:red,mod:bold) Scroll Down
+		[<Ctr-b>    ](fg:red,mod:bold) list Page Up
+		[<Ctr-f>    ](fg:red,mod:bold) list Page Down           
+		[p          ](fg:red,mod:bold) list Page Up
+		[n          ](fg:red,mod:bold) list Page Down
+		[<Ctr-u>    ](fg:red,mod:bold) Scroll Half Page Up
+		[<Ctr-d>    ](fg:red,mod:bold) Scroll Half Page Down
+		[<Home>     ](fg:red,mod:bold) Scroll to Top
+		[<Enter>    ](fg:red,mod:bold) Show Trace
+		[<End>      ](fg:red,mod:bold) Scroll to Bottom
+		[q          ](fg:red,mod:bold) Quit
+		[<Ctr-c>    ](fg:red,mod:bold) Quit
+        `
+	draw(list, tree, help, data, 0, ctx, condition)
+	listenTracesKeyboard(list, tree, data, ctx, help, condition)
+
+	return nil
+}
+
+func draw(list *widgets.List, tree *widgets.Tree, help *widgets.Paragraph, data schema.TraceBrief, showIndex int,
+	ctx *cli.Context, condition *schema.TraceQueryCondition) {
+	x, y := ui.TerminalDimensions()
+
+	if data.Total != 0 {
+		var traceID = data.Traces[showIndex].TraceIds[0]
+		list.Title = fmt.Sprintf("[ %d/%d  %s]", *condition.Paging.PageNum, totalPages(data.Total), traceID)
+		nodes, serviceNames := getNodeData(ctx, traceID)
+		tree.Title = fmt.Sprintf("[%s]", strings.Join(serviceNames, "->"))
+		tree.SetNodes(nodes)
+		list.Rows = rows(data, x/4)
+	} else {
+		noData := "no data"
+		list.Title = noData
+		tree.Title = noData
+	}
+
+	list.SetRect(0, 0, x, y)
+	tree.SetRect(x/4, 0, x, y)
+	help.SetRect(x-x/7, 0, x, y)
+	tree.ExpandAll()

Review comment:
       The reason why we cannot switch the focus between the `list` and `tree` is that we manually set the rectangle area of them, by placing these widgets into containers, the focus can be switched between them, refer to `skywalking-cli/display/graph/linear/linear.go`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] alonelaval commented on a change in pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
alonelaval commented on a change in pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56#discussion_r471484753



##########
File path: .gitmodules
##########
@@ -1,3 +1,4 @@
 [submodule "query-protocol"]
 	path = query-protocol
 	url = http://github.com/apache/skywalking-query-protocol/
+    branch = master

Review comment:
       I haven't used submodules, ci errors, keep trying.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] wu-sheng commented on a change in pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56#discussion_r471469655



##########
File path: .gitmodules
##########
@@ -1,3 +1,4 @@
 [submodule "query-protocol"]
 	path = query-protocol
 	url = http://github.com/apache/skywalking-query-protocol/
+    branch = master

Review comment:
       What is this?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] codecov-commenter commented on pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56#issuecomment-674866613


   # [Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/56?src=pr&el=h1) Report
   > Merging [#56](https://codecov.io/gh/apache/skywalking-cli/pull/56?src=pr&el=desc) into [master](https://codecov.io/gh/apache/skywalking-cli/commit/744192f01ad5670769088fabbf30959246fe3696&el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/skywalking-cli/pull/56/graphs/tree.svg?width=650&height=150&src=pr&token=oivudZDTNJ)](https://codecov.io/gh/apache/skywalking-cli/pull/56?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master      #56   +/-   ##
   =======================================
     Coverage   51.20%   51.20%           
   =======================================
     Files           7        7           
     Lines         125      125           
   =======================================
     Hits           64       64           
     Misses         53       53           
     Partials        8        8           
   ```
   
   
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/56?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/skywalking-cli/pull/56?src=pr&el=footer). Last update [744192f...cea5091](https://codecov.io/gh/apache/skywalking-cli/pull/56?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking-cli] alonelaval commented on a change in pull request #56: Add traces search

Posted by GitBox <gi...@apache.org>.
alonelaval commented on a change in pull request #56:
URL: https://github.com/apache/skywalking-cli/pull/56#discussion_r472075261



##########
File path: display/graph/tree/list.go
##########
@@ -0,0 +1,190 @@
+// 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 tree
+
+import (
+	"fmt"
+	"strings"
+
+	d "github.com/apache/skywalking-cli/display/displayable"
+	"github.com/apache/skywalking-cli/graphql/schema"
+	"github.com/apache/skywalking-cli/graphql/trace"
+
+	ui "github.com/gizak/termui/v3"
+	"github.com/gizak/termui/v3/widgets"
+	"github.com/urfave/cli"
+
+	"github.com/apache/skywalking-cli/logger"
+)
+
+const DefaultPageSize = 15
+const keymap = " Keymap "
+const cc = "<C-c>"
+
+func DisplayList(ctx *cli.Context, displayable *d.Displayable) error {
+	data := displayable.Data.(schema.TraceBrief)
+	condition := displayable.Condition.(*schema.TraceQueryCondition)
+	if err := ui.Init(); err != nil {
+		logger.Log.Fatalf("failed to initialize termui: %v", err)
+	}
+	defer ui.Close()
+
+	list := widgets.NewList()
+	list.TitleStyle.Fg = ui.ColorRed
+	list.TextStyle = ui.NewStyle(ui.ColorYellow)
+	list.WrapText = false
+
+	tree := widgets.NewTree()
+	tree.TextStyle = ui.NewStyle(ui.ColorYellow)
+	tree.WrapText = false
+	tree.TitleStyle.Fg = ui.ColorRed
+
+	help := widgets.NewParagraph()
+	help.WrapText = false
+	help.Title = keymap
+	help.Text = `[k          ](fg:red,mod:bold) Scroll Up
+		[<Up>       ](fg:red,mod:bold) Scroll Up
+		[j          ](fg:red,mod:bold) Scroll Down
+		[<Down>     ](fg:red,mod:bold) Scroll Down
+		[<Ctr-b>    ](fg:red,mod:bold) list Page Up
+		[<Ctr-f>    ](fg:red,mod:bold) list Page Down           
+		[p          ](fg:red,mod:bold) list Page Up
+		[n          ](fg:red,mod:bold) list Page Down
+		[<Ctr-u>    ](fg:red,mod:bold) Scroll Half Page Up
+		[<Ctr-d>    ](fg:red,mod:bold) Scroll Half Page Down
+		[<Home>     ](fg:red,mod:bold) Scroll to Top
+		[<Enter>    ](fg:red,mod:bold) Show Trace
+		[<End>      ](fg:red,mod:bold) Scroll to Bottom
+		[q          ](fg:red,mod:bold) Quit
+		[<Ctr-c>    ](fg:red,mod:bold) Quit
+        `
+	draw(list, tree, help, data, 0, ctx, condition)
+	listenTracesKeyboard(list, tree, data, ctx, help, condition)
+
+	return nil
+}
+
+func draw(list *widgets.List, tree *widgets.Tree, help *widgets.Paragraph, data schema.TraceBrief, showIndex int,
+	ctx *cli.Context, condition *schema.TraceQueryCondition) {
+	x, y := ui.TerminalDimensions()
+
+	if data.Total != 0 {
+		var traceID = data.Traces[showIndex].TraceIds[0]
+		list.Title = fmt.Sprintf("[ %d/%d  %s]", *condition.Paging.PageNum, totalPages(data.Total), traceID)
+		nodes, serviceNames := getNodeData(ctx, traceID)
+		tree.Title = fmt.Sprintf("[%s]", strings.Join(serviceNames, "->"))
+		tree.SetNodes(nodes)
+		list.Rows = rows(data, x/4)
+	} else {
+		noData := "no data"
+		list.Title = noData
+		tree.Title = noData
+	}
+
+	list.SetRect(0, 0, x, y)
+	tree.SetRect(x/4, 0, x, y)
+	help.SetRect(x-x/7, 0, x, y)
+	tree.ExpandAll()

Review comment:
       ok. i will check.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org