Skip to content

Commit a199184

Browse files
author
Peter Jausovec
committed
Update the label is not valid error message to include the fqName
Fixes #504. Signed-off-by: Peter Jausovec <[email protected]>
1 parent 3fb53df commit a199184

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prometheus/desc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
9393
// First add only the const label names and sort them...
9494
for labelName := range constLabels {
9595
if !checkLabelName(labelName) {
96-
d.err = fmt.Errorf("%q is not a valid label name", labelName)
96+
d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
9797
return d
9898
}
9999
labelNames = append(labelNames, labelName)
@@ -115,7 +115,7 @@ func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *
115115
// dimension with a different mix between preset and variable labels.
116116
for _, labelName := range variableLabels {
117117
if !checkLabelName(labelName) {
118-
d.err = fmt.Errorf("%q is not a valid label name", labelName)
118+
d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
119119
return d
120120
}
121121
labelNames = append(labelNames, "$"+labelName)

0 commit comments

Comments
 (0)