MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / collect

Function collect

metric/metricweb.go:32–54  ·  view source on GitHub ↗
(cc *CollectClient)

Source from the content-addressed store, hash-verified

30)
31
32func collect(cc *CollectClient) (err error) {
33 mfs, err := cc.Registry.Gather()
34 if err != nil {
35 err = errors.Wrap(err, "gathering node metrics failed")
36 return
37 }
38 mm := make(SimpleMetricMap, 0)
39 for _, mf := range mfs {
40 mm[*mf.Name] = mf
41 log.Debugf("gathered node: %v", mf)
42 }
43 crucialMetrics := mm.FilterCrucialMetrics()
44 for k, v := range crucialMetrics {
45 var val expvar.Var
46 if val = expvar.Get(k); val == nil {
47 expvar.Publish(k, mw.NewGauge("1h1m"))
48 val = expvar.Get(k)
49 }
50 val.(mw.Metric).Add(v)
51 }
52
53 return
54}
55
56// InitMetricWeb initializes the /debug/metrics web.
57func InitMetricWeb(metricWeb string) (err error) {

Callers 1

InitMetricWebFunction · 0.85

Calls 5

DebugfFunction · 0.92
FilterCrucialMetricsMethod · 0.80
GetMethod · 0.65
PublishMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected