浏览代码

fix: viewer function receiving null node list (#266)

Martin Spier 7 年前
父节点
当前提交
77ec2c44fb
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4
    0
      internal/driver/flamegraph.go

+ 4
- 0
internal/driver/flamegraph.go 查看文件

@@ -47,6 +47,7 @@ func (ui *webInterface) flamegraph(w http.ResponseWriter, req *http.Request) {
47 47
 	var nodes []*treeNode
48 48
 	nroots := 0
49 49
 	rootValue := int64(0)
50
+	nodeArr := []string{}
50 51
 	nodeMap := map[*graph.Node]*treeNode{}
51 52
 	// Make all nodes and the map, collect the roots.
52 53
 	for _, n := range g.Nodes {
@@ -64,6 +65,8 @@ func (ui *webInterface) flamegraph(w http.ResponseWriter, req *http.Request) {
64 65
 			rootValue += v
65 66
 		}
66 67
 		nodeMap[n] = node
68
+		// Get all node names into an array.
69
+		nodeArr = append(nodeArr, n.Info.Name)
67 70
 	}
68 71
 	// Populate the child links.
69 72
 	for _, n := range g.Nodes {
@@ -91,5 +94,6 @@ func (ui *webInterface) flamegraph(w http.ResponseWriter, req *http.Request) {
91 94
 
92 95
 	ui.render(w, "/flamegraph", "flamegraph", rpt, errList, config.Labels, webArgs{
93 96
 		FlameGraph: template.JS(b),
97
+		Nodes:      nodeArr,
94 98
 	})
95 99
 }