Be more robust about nil pointers in protobuf
While not strictly correct, it can easily happen that proto messages are created that use nil pointers instead of pointers in empty strings to denote an empty string. Signed-off-by: beorn7 <beorn@soundcloud.com>
This commit is contained in:
parent
c51dc758d4
commit
1b56b5c497
|
@ -727,8 +727,8 @@ func checkMetricConsistency(
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, labelPair := range dtoMetric.GetLabel() {
|
for _, labelPair := range dtoMetric.GetLabel() {
|
||||||
if !utf8.ValidString(*labelPair.Value) {
|
if !utf8.ValidString(labelPair.GetValue()) {
|
||||||
return fmt.Errorf("collected metric's label %s is not utf8: %#v", *labelPair.Name, *labelPair.Value)
|
return fmt.Errorf("collected metric's label %s is not utf8: %#v", labelPair.GetName(), labelPair.GetValue())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue