Skip to content

Commit 3d765a1

Browse files
Add context to "duplicate label names" to enable debugging (#1177)
* Add context to "duplicate label names" to enable debugging Signed-off-by: SpencerMalone <[email protected]> * Remove unused errors package import. Signed-off-by: SpencerMalone <[email protected]> Signed-off-by: SpencerMalone <[email protected]>
1 parent 07b1397 commit 3d765a1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

prometheus/desc.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package prometheus
1515

1616
import (
17-
"errors"
1817
"fmt"
1918
"sort"
2019
"strings"
@@ -127,7 +126,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
127126
labelNameSet[labelName] = struct{}{}
128127
}
129128
if len(labelNames) != len(labelNameSet) {
130-
d.err = errors.New("duplicate label names")
129+
d.err = fmt.Errorf("duplicate label names in constant and variable labels for metric %q", fqName)
131130
return d
132131
}
133132

0 commit comments

Comments
 (0)