Add context to "duplicate label names" to enable debugging (#1177)
* Add context to "duplicate label names" to enable debugging Signed-off-by: SpencerMalone <malone.spencer@gmail.com> * Remove unused errors package import. Signed-off-by: SpencerMalone <malone.spencer@gmail.com> Signed-off-by: SpencerMalone <malone.spencer@gmail.com>
This commit is contained in:
parent
07b1397ded
commit
3d765a161a
|
@ -14,7 +14,6 @@
|
||||||
package prometheus
|
package prometheus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -127,7 +126,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
|
||||||
labelNameSet[labelName] = struct{}{}
|
labelNameSet[labelName] = struct{}{}
|
||||||
}
|
}
|
||||||
if len(labelNames) != len(labelNameSet) {
|
if len(labelNames) != len(labelNameSet) {
|
||||||
d.err = errors.New("duplicate label names")
|
d.err = fmt.Errorf("duplicate label names in constant and variable labels for metric %q", fqName)
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue