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

Function ExampleGauge

prometheus/examples_test.go:35–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33)
34
35func ExampleGauge() {
36 opsQueued := prometheus.NewGauge(prometheus.GaugeOpts{
37 Namespace: "our_company",
38 Subsystem: "blob_storage",
39 Name: "ops_queued",
40 Help: "Number of blob storage operations waiting to be processed.",
41 })
42 prometheus.MustRegister(opsQueued)
43
44 // 10 operations queued by the goroutine managing incoming requests.
45 opsQueued.Add(10)
46 // A worker goroutine has picked up a waiting operation.
47 opsQueued.Dec()
48 // And once more...
49 opsQueued.Dec()
50}
51
52func ExampleGaugeVec() {
53 opsQueued := prometheus.NewGaugeVec(

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
DecMethod · 0.95
NewGaugeFunction · 0.92
MustRegisterFunction · 0.92

Tested by

no test coverage detected