(t testing.TB, metrics []*dto.MetricFamily, name string, labels ...string)
| 61 | } |
| 62 | |
| 63 | func getMetric(t testing.TB, metrics []*dto.MetricFamily, name string, labels ...string) *dto.Metric { |
| 64 | for _, family := range metrics { |
| 65 | if family.GetName() != name { |
| 66 | continue |
| 67 | } |
| 68 | ms := family.GetMetric() |
| 69 | metricsLoop: |
| 70 | for _, m := range ms { |
| 71 | require.Equal(t, len(labels), len(m.GetLabel())) |
| 72 | for i, lv := range labels { |
| 73 | if lv != m.GetLabel()[i].GetValue() { |
| 74 | continue metricsLoop |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return m |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | return nil |
| 83 | } |
no test coverage detected