MCPcopy
hub / github.com/prometheus/client_golang / startFireKeeper

Function startFireKeeper

examples/customlabels/main.go:54–80  ·  view source on GitHub ↗
(reg prometheus.Registerer)

Source from the content-addressed store, hash-verified

52}
53
54func startFireKeeper(reg prometheus.Registerer) {
55 firesMaintained := promauto.With(reg).NewCounter(prometheus.CounterOpts{
56 Name: "fires_maintained_total",
57 Help: "Total number of fires maintained",
58 })
59
60 sparksDistributed := promauto.With(reg).NewCounter(prometheus.CounterOpts{
61 Name: "sparks_distributed_total",
62 Help: "Total number of sparks distributed",
63 })
64
65 go func() {
66 for {
67 time.Sleep(5 * time.Second)
68 firesMaintained.Inc()
69 log.Println("FireKeeper maintained a fire")
70 }
71 }()
72
73 go func() {
74 for {
75 time.Sleep(7 * time.Second)
76 sparksDistributed.Inc()
77 log.Println("FireKeeper distributed a spark")
78 }
79 }()
80}
81
82func startSparkForge(reg prometheus.Registerer) {
83 itemsForged := promauto.With(reg).NewCounter(prometheus.CounterOpts{

Callers 1

mainFunction · 0.85

Calls 4

IncMethod · 0.95
WithFunction · 0.92
NewCounterMethod · 0.80
PrintlnMethod · 0.65

Tested by

no test coverage detected