(c prometheus.Collector, label string)
| 370 | } |
| 371 | |
| 372 | func isLabelCurried(c prometheus.Collector, label string) bool { |
| 373 | // This is even hackier than the label test above. |
| 374 | // We essentially try to curry again and see if it works. |
| 375 | // But for that, we need to type-convert to the two |
| 376 | // types we use here, ObserverVec or *CounterVec. |
| 377 | switch v := c.(type) { |
| 378 | case *prometheus.CounterVec: |
| 379 | if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil { |
| 380 | return false |
| 381 | } |
| 382 | case prometheus.ObserverVec: |
| 383 | if _, err := v.CurryWith(prometheus.Labels{label: "dummy"}); err == nil { |
| 384 | return false |
| 385 | } |
| 386 | default: |
| 387 | panic("unsupported metric vec type") |
| 388 | } |
| 389 | return true |
| 390 | } |
| 391 | |
| 392 | func labels(code, method bool, reqMethod string, status int, extraMethods ...string) prometheus.Labels { |
| 393 | labels := prometheus.Labels{} |
no test coverage detected