(labels1, labels2 []*dto.LabelPair)
| 977 | } |
| 978 | |
| 979 | func (m *MetricMap) compareLabels(labels1, labels2 []*dto.LabelPair) bool { |
| 980 | if len(labels1) != len(labels2) { |
| 981 | return false |
| 982 | } |
| 983 | |
| 984 | // create a map of labels for lookup |
| 985 | labelMap := make(map[string]string) |
| 986 | for _, labelPair := range labels1 { |
| 987 | labelMap[labelPair.GetName()] = labelPair.GetValue() |
| 988 | } |
| 989 | |
| 990 | for _, labelPair := range labels2 { |
| 991 | if value, found := labelMap[labelPair.GetName()]; found { |
| 992 | if value != labelPair.GetValue() { |
| 993 | return false |
| 994 | } |
| 995 | } else { |
| 996 | return false |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | return true |
| 1001 | } |
no test coverage detected