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

Function StartMetricCollector

metric/metric.go:33–58  ·  view source on GitHub ↗

StartMetricCollector starts collector registered in NewNodeCollector().

()

Source from the content-addressed store, hash-verified

31
32// StartMetricCollector starts collector registered in NewNodeCollector().
33func StartMetricCollector() (registry *prometheus.Registry) {
34 nc, err := NewNodeCollector()
35 if err != nil {
36 log.WithError(err).Error("couldn't create node collector")
37 return
38 }
39
40 registry = prometheus.NewRegistry()
41 err = registry.Register(nc)
42 if err != nil {
43 log.WithError(err).Error("couldn't register collector")
44 return nil
45 }
46
47 log.Info("enabled collectors:")
48 var collectors []string
49 for n := range nc.Collectors {
50 collectors = append(collectors, n)
51 }
52 sort.Strings(collectors)
53 for _, n := range collectors {
54 log.Infof(" - %s", n)
55 }
56
57 return
58}

Callers 2

mainFunction · 0.92
NewCollectClientFunction · 0.85

Calls 6

WithErrorFunction · 0.92
InfoFunction · 0.92
InfofFunction · 0.92
NewNodeCollectorFunction · 0.85
ErrorMethod · 0.80
RegisterMethod · 0.80

Tested by

no test coverage detected