Skip to content

Commit

Permalink
Add context to "duplicate label names" to enable debugging (#1177)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
SpencerMalone committed Dec 13, 2022
1 parent 07b1397 commit 3d765a1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions prometheus/desc.go
Expand Up @@ -14,7 +14,6 @@
package prometheus

import (
"errors"
"fmt"
"sort"
"strings"
Expand Down Expand Up @@ -127,7 +126,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
labelNameSet[labelName] = struct{}{}
}
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
}

Expand Down

0 comments on commit 3d765a1

Please sign in to comment.