diff --git a/plugins/parsers/prometheusremotewrite/parser.go b/plugins/parsers/prometheusremotewrite/parser.go index 72695f471d9b5..3480d3c61b1a6 100644 --- a/plugins/parsers/prometheusremotewrite/parser.go +++ b/plugins/parsers/prometheusremotewrite/parser.go @@ -7,9 +7,7 @@ import ( "time" "github.com/prometheus/common/model" - "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/prompb" - "github.com/prometheus/prometheus/storage/remote" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/metric" @@ -63,12 +61,7 @@ func (p *Parser) Parse(buf []byte) ([]telegraf.Metric, error) { } for _, hp := range ts.Histograms { - var h *histogram.FloatHistogram - if hp.IsFloatHistogram() { - h = remote.FloatHistogramProtoToFloatHistogram(hp) - } else { - h = remote.HistogramProtoToFloatHistogram(hp) - } + h := hp.ToFloatHistogram() if hp.Timestamp > 0 { t = time.Unix(0, hp.Timestamp*1000000) diff --git a/plugins/parsers/prometheusremotewrite/parser_test.go b/plugins/parsers/prometheusremotewrite/parser_test.go index a7cddb477adcd..f98c4ca516e58 100644 --- a/plugins/parsers/prometheusremotewrite/parser_test.go +++ b/plugins/parsers/prometheusremotewrite/parser_test.go @@ -6,7 +6,6 @@ import ( "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/prompb" - "github.com/prometheus/prometheus/storage/remote" "github.com/stretchr/testify/require" "github.com/influxdata/telegraf" @@ -122,7 +121,7 @@ func TestHistograms(t *testing.T) { {Name: "__name__", Value: "test_metric_seconds"}, }, Histograms: []prompb.Histogram{ - remote.HistogramToHistogramProto(0, generateTestHistogram(1)), + prompb.FromIntHistogram(0, generateTestHistogram(1)), }, }, { @@ -130,7 +129,7 @@ func TestHistograms(t *testing.T) { {Name: "__name__", Value: "test_float_metric_seconds"}, }, Histograms: []prompb.Histogram{ - remote.FloatHistogramToHistogramProto(0, generateTestFloatHistogram(2)), + prompb.FromFloatHistogram(0, generateTestFloatHistogram(2)), }, }, },