(t testing.TB, metrics []*dto.MetricFamily, kind kind, name string, labels ...string)
| 45 | } |
| 46 | |
| 47 | func getValue(t testing.TB, metrics []*dto.MetricFamily, kind kind, name string, labels ...string) float64 { |
| 48 | m := getMetric(t, metrics, name, labels...) |
| 49 | if m == nil { |
| 50 | return -1 |
| 51 | } |
| 52 | |
| 53 | switch kind { |
| 54 | case counterKind: |
| 55 | return m.GetCounter().GetValue() |
| 56 | case gaugeKind: |
| 57 | return m.GetGauge().GetValue() |
| 58 | default: |
| 59 | return -1 |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func getMetric(t testing.TB, metrics []*dto.MetricFamily, name string, labels ...string) *dto.Metric { |
| 64 | for _, family := range metrics { |
no test coverage detected