mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
Option to censor raw reports by command line args and env vars.
This commit is contained in:
@@ -86,12 +86,12 @@ type RenderContext struct {
|
||||
|
||||
// MakeNode transforms a renderable node to a detailed node. It uses
|
||||
// aggregate metadata, plus the set of origin node IDs, to produce tables.
|
||||
func MakeNode(topologyID string, rc RenderContext, ns report.Nodes, n report.Node) Node {
|
||||
summary, _ := MakeNodeSummary(rc, n)
|
||||
func MakeNode(topologyID string, rc RenderContext, hideCommandLineArguments bool, ns report.Nodes, n report.Node) Node {
|
||||
summary, _ := MakeNodeSummary(rc, hideCommandLineArguments, n)
|
||||
return Node{
|
||||
NodeSummary: summary,
|
||||
Controls: controls(rc.Report, n),
|
||||
Children: children(rc, n),
|
||||
Children: children(rc, hideCommandLineArguments, n),
|
||||
Connections: []ConnectionsSummary{
|
||||
incomingConnectionsSummary(topologyID, rc.Report, n, ns),
|
||||
outgoingConnectionsSummary(topologyID, rc.Report, n, ns),
|
||||
@@ -222,13 +222,13 @@ var nodeSummaryGroupSpecs = []struct {
|
||||
},
|
||||
}
|
||||
|
||||
func children(rc RenderContext, n report.Node) []NodeSummaryGroup {
|
||||
func children(rc RenderContext, hideCommandLineArguments bool, n report.Node) []NodeSummaryGroup {
|
||||
summaries := map[string][]NodeSummary{}
|
||||
n.Children.ForEach(func(child report.Node) {
|
||||
if child.ID == n.ID {
|
||||
return
|
||||
}
|
||||
summary, ok := MakeNodeSummary(rc, child)
|
||||
summary, ok := MakeNodeSummary(rc, hideCommandLineArguments, child)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func child(t *testing.T, r render.Renderer, id string) detailed.NodeSummary {
|
||||
s, ok := detailed.MakeNodeSummary(detailed.RenderContext{Report: fixture.Report}, r.Render(context.Background(), fixture.Report).Nodes[id])
|
||||
s, ok := detailed.MakeNodeSummary(detailed.RenderContext{Report: fixture.Report}, false, r.Render(context.Background(), fixture.Report).Nodes[id])
|
||||
if !ok {
|
||||
t.Fatalf("Expected node %s to be summarizable, but wasn't", id)
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ func MakeBasicNodeSummary(r report.Report, n report.Node) (BasicNodeSummary, boo
|
||||
}
|
||||
|
||||
// MakeNodeSummary summarizes a node, if possible.
|
||||
func MakeNodeSummary(rc RenderContext, n report.Node) (NodeSummary, bool) {
|
||||
func MakeNodeSummary(rc RenderContext, hideCommandLineArguments bool, n report.Node) (NodeSummary, bool) {
|
||||
base, ok := MakeBasicNodeSummary(rc.Report, n)
|
||||
if !ok {
|
||||
return NodeSummary{}, false
|
||||
@@ -449,13 +449,13 @@ func (s nodeSummariesByID) Less(i, j int) bool { return s[i].ID < s[j].ID }
|
||||
type NodeSummaries map[string]NodeSummary
|
||||
|
||||
// Summaries converts RenderableNodes into a set of NodeSummaries
|
||||
func Summaries(ctx context.Context, rc RenderContext, rns report.Nodes) NodeSummaries {
|
||||
func Summaries(ctx context.Context, rc RenderContext, hideCommandLineArguments bool, rns report.Nodes) NodeSummaries {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "detailed.Summaries")
|
||||
defer span.Finish()
|
||||
|
||||
result := NodeSummaries{}
|
||||
for id, node := range rns {
|
||||
if summary, ok := MakeNodeSummary(rc, node); ok {
|
||||
if summary, ok := MakeNodeSummary(rc, hideCommandLineArguments, node); ok {
|
||||
for i, m := range summary.Metrics {
|
||||
summary.Metrics[i] = m.Summary()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user