MCPcopy Create free account
hub / github.com/weaveworks/scope / AddCounter

Method AddCounter

report/node.go:95–101  ·  view source on GitHub ↗

AddCounter returns a fresh copy of n, with Counter c added in. (counters are stored as strings, to keep the data structure simple)

(k string, value int)

Source from the content-addressed store, hash-verified

93// AddCounter returns a fresh copy of n, with Counter c added in.
94// (counters are stored as strings, to keep the data structure simple)
95func (n Node) AddCounter(k string, value int) Node {
96 name := CounterPrefix + k
97 if prevValue, found := n.LookupCounter(k); found {
98 value += prevValue
99 }
100 return n.WithLatest(name, mtime.Now(), strconv.Itoa(value))
101}
102
103// WithSet returns a fresh copy of n, with set merged in at key.
104func (n Node) WithSet(key string, set StringSet) Node {

Callers 5

CodecDecodeSelfMethod · 0.95
addUnmappedChildMethod · 0.80
expected.goFile · 0.80
TestNodeFunction · 0.80
TestCountersFunction · 0.80

Calls 2

LookupCounterMethod · 0.95
WithLatestMethod · 0.95

Tested by 2

TestNodeFunction · 0.64
TestCountersFunction · 0.64