(m *dto.Metric, labelNames []string)
| 366 | } |
| 367 | |
| 368 | func getLabelValues(m *dto.Metric, labelNames []string) ([]string, bool) { |
| 369 | result := make([]string, 0, len(labelNames)) |
| 370 | |
| 371 | for _, ln := range labelNames { |
| 372 | found := false |
| 373 | |
| 374 | // Look for the label among the metric ones. We re-iterate on each metric label |
| 375 | // which is algorithmically bad, but the main assumption is that the labelNames |
| 376 | // in input are typically very few units. |
| 377 | for _, lp := range m.GetLabel() { |
| 378 | if ln != lp.GetName() { |
| 379 | continue |
| 380 | } |
| 381 | |
| 382 | result = append(result, lp.GetValue()) |
| 383 | found = true |
| 384 | break |
| 385 | } |
| 386 | |
| 387 | if !found { |
| 388 | // required labels not found |
| 389 | return nil, false |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | return result, true |
| 394 | } |
| 395 | |
| 396 | func getLabelsString(labelValues []string) string { |
| 397 | // Get a buffer from the pool, reset it and release it at the |
no test coverage detected