@cryptotaxi247 / netdata-1 / commits / 4f2adbdf8

go.d pkg prometheus improve parsing err msg (#17480)

Ilya Mashchenko committed Apr 22, 2024 at 15:34 UTC 4f2adbdf8a12ee5c5976e578ae0171b51b6e86ee
1 file changed +3 -2
src/go/collectors/go.d.plugin/pkg/prometheus/parse.go
+3 -2
@@ -2,6 +2,7 @@ package prometheus
2
3 import (
4 "errors"
5 + "fmt"
6 "io"
7 "regexp"
8 "strconv"
@@ -59,7 +60,7 @@ func (p *promTextParser) parseToSeries(text []byte) (Series, error) {
60 if entry == textparse.EntryInvalid && strings.HasPrefix(err.Error(), "invalid metric type") {
61 continue
62 }
62 - return nil, err
63 + return nil, fmt.Errorf("failed to parse prometheus metrics: %v", err)
64 }
65
66 switch entry {
@@ -97,7 +98,7 @@ func (p *promTextParser) parseToMetricFamilies(text []byte) (MetricFamilies, err
98 if entry == textparse.EntryInvalid && strings.HasPrefix(err.Error(), "invalid metric type") {
99 continue
100 }
100 - return nil, err
101 + return nil, fmt.Errorf("failed to parse prometheus metrics: %v", err)
102 }
103
104 switch entry {