()
| 74 | } |
| 75 | |
| 76 | func ExampleGaugeFunc_simple() { |
| 77 | if err := prometheus.Register(prometheus.NewGaugeFunc( |
| 78 | prometheus.GaugeOpts{ |
| 79 | Subsystem: "runtime", |
| 80 | Name: "goroutines_count", |
| 81 | Help: "Number of goroutines that currently exist.", |
| 82 | }, |
| 83 | func() float64 { return float64(runtime.NumGoroutine()) }, |
| 84 | )); err == nil { |
| 85 | fmt.Println("GaugeFunc 'goroutines_count' registered.") |
| 86 | } |
| 87 | // Note that the count of goroutines is a gauge (and not a counter) as |
| 88 | // it can go up and down. |
| 89 | |
| 90 | // Output: |
| 91 | // GaugeFunc 'goroutines_count' registered. |
| 92 | } |
| 93 | |
| 94 | func ExampleGaugeFunc_constLabels() { |
| 95 | // primaryDB and secondaryDB represent two example *sql.DB connections we want to instrument. |
nothing calls this directly
no test coverage detected