()
| 50 | } |
| 51 | |
| 52 | func ExampleGaugeVec() { |
| 53 | opsQueued := prometheus.NewGaugeVec( |
| 54 | prometheus.GaugeOpts{ |
| 55 | Namespace: "our_company", |
| 56 | Subsystem: "blob_storage", |
| 57 | Name: "ops_queued", |
| 58 | Help: "Number of blob storage operations waiting to be processed, partitioned by user and type.", |
| 59 | }, |
| 60 | []string{ |
| 61 | // Which user has requested the operation? |
| 62 | "user", |
| 63 | // Of what type is the operation? |
| 64 | "type", |
| 65 | }, |
| 66 | ) |
| 67 | prometheus.MustRegister(opsQueued) |
| 68 | |
| 69 | // Increase a value using compact (but order-sensitive!) WithLabelValues(). |
| 70 | opsQueued.WithLabelValues("bob", "put").Add(4) |
| 71 | // Increase a value with a map using WithLabels. More verbose, but order |
| 72 | // doesn't matter anymore. |
| 73 | opsQueued.With(prometheus.Labels{"type": "delete", "user": "alice"}).Inc() |
| 74 | } |
| 75 | |
| 76 | func ExampleGaugeFunc_simple() { |
| 77 | if err := prometheus.Register(prometheus.NewGaugeFunc( |
nothing calls this directly
no test coverage detected