MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / NewCovenantSQLCollector

Function NewCovenantSQLCollector

metric/covenantmetric.go:52–77  ·  view source on GitHub ↗

NewCovenantSQLCollector returns a new CovenantSQLCollector.

()

Source from the content-addressed store, hash-verified

50
51// NewCovenantSQLCollector returns a new CovenantSQLCollector.
52func NewCovenantSQLCollector() prometheus.Collector {
53 cc := &CovenantSQLCollector{
54 covenantSQLStatHistory: [historyCount]int64{},
55 RWMutex: sync.RWMutex{},
56 metrics: covenantSQLStatsMetrics{
57 {
58 desc: prometheus.NewDesc(
59 covenantSQLStatNamespace("db_random"),
60 "CovenantSQL random",
61 nil,
62 nil,
63 ),
64 eval: CovenantSQLIdle,
65 valType: prometheus.GaugeValue,
66 },
67 },
68 }
69
70 go func(cc *CovenantSQLCollector) {
71 for {
72 cc.updateCovenantSQLStat()
73 time.Sleep(updateInterval)
74 }
75 }(cc)
76 return cc
77}
78
79// Describe returns all descriptions of the collector.
80func (cc *CovenantSQLCollector) Describe(ch chan<- *prometheus.Desc) {

Callers 1

TestMetricsFunction · 0.85

Calls 2

updateCovenantSQLStatMethod · 0.95
covenantSQLStatNamespaceFunction · 0.85

Tested by 1

TestMetricsFunction · 0.68