diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2024-04-22 15:34:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-22 15:34:04 +0300 |
commit | 4f2adbdf8a12ee5c5976e578ae0171b51b6e86ee (patch) | |
tree | 16f401f0fa03a3c00292f2f2bddce5eb76a4505e /src | |
parent | 3a019641e02fe08acbb9a3d0cb1186844f77bb34 (diff) |
go.d pkg prometheus improve parsing err msg (#17480)
Diffstat (limited to 'src')
-rw-r--r-- | src/go/collectors/go.d.plugin/pkg/prometheus/parse.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/go/collectors/go.d.plugin/pkg/prometheus/parse.go b/src/go/collectors/go.d.plugin/pkg/prometheus/parse.go index db17cb83bd..958d662896 100644 --- a/src/go/collectors/go.d.plugin/pkg/prometheus/parse.go +++ b/src/go/collectors/go.d.plugin/pkg/prometheus/parse.go @@ -2,6 +2,7 @@ package prometheus import ( "errors" + "fmt" "io" "regexp" "strconv" @@ -59,7 +60,7 @@ func (p *promTextParser) parseToSeries(text []byte) (Series, error) { if entry == textparse.EntryInvalid && strings.HasPrefix(err.Error(), "invalid metric type") { continue } - return nil, err + return nil, fmt.Errorf("failed to parse prometheus metrics: %v", err) } switch entry { @@ -97,7 +98,7 @@ func (p *promTextParser) parseToMetricFamilies(text []byte) (MetricFamilies, err if entry == textparse.EntryInvalid && strings.HasPrefix(err.Error(), "invalid metric type") { continue } - return nil, err + return nil, fmt.Errorf("failed to parse prometheus metrics: %v", err) } switch entry { |