addWithExemplar is a wrapper for [prometheus.ExemplarAdder.AddWithExemplar], which falls back to [prometheus.Counter.Add] if no labels are provided.
(obs prometheus.Counter, val float64, labels map[string]string)
| 41 | // addWithExemplar is a wrapper for [prometheus.ExemplarAdder.AddWithExemplar], |
| 42 | // which falls back to [prometheus.Counter.Add] if no labels are provided. |
| 43 | func addWithExemplar(obs prometheus.Counter, val float64, labels map[string]string) { |
| 44 | if labels == nil { |
| 45 | obs.Add(val) |
| 46 | return |
| 47 | } |
| 48 | obs.(prometheus.ExemplarAdder).AddWithExemplar(val, labels) |
| 49 | } |
| 50 | |
| 51 | // InstrumentHandlerInFlight is a middleware that wraps the provided |
| 52 | // http.Handler. It sets the provided prometheus.Gauge to the number of |
no test coverage detected