(desc *Desc, labels Labels)
| 663 | } |
| 664 | |
| 665 | func constrainLabels(desc *Desc, labels Labels) (Labels, func()) { |
| 666 | if len(desc.variableLabels.labelConstraints) == 0 { |
| 667 | // Fast path when there's no constraints |
| 668 | return labels, func() {} |
| 669 | } |
| 670 | |
| 671 | constrainedLabels := labelsPool.Get().(Labels) |
| 672 | for l, v := range labels { |
| 673 | constrainedLabels[l] = desc.variableLabels.constrain(l, v) |
| 674 | } |
| 675 | |
| 676 | return constrainedLabels, func() { |
| 677 | for k := range constrainedLabels { |
| 678 | delete(constrainedLabels, k) |
| 679 | } |
| 680 | labelsPool.Put(constrainedLabels) |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | func constrainLabelValues(desc *Desc, lvs []string, curry []curriedLabelValue) []string { |
| 685 | if len(desc.variableLabels.labelConstraints) == 0 { |
no test coverage detected