Skip to content

Commit

Permalink
Fixed native histogram proto conversion in remote engine
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Rabenhorst <[email protected]>
  • Loading branch information
rabenhorst committed May 5, 2023
1 parent eb7b748 commit edbc7ca
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/query/remote_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/parser"
Expand Down Expand Up @@ -197,10 +198,18 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
F: s.Value,
})
}
for _, h := range ts.Histograms {
for _, hp := range ts.Histograms {
var fh *histogram.FloatHistogram

if hp.IsFloatHistogram() {
fh = prompb.FloatHistogramProtoToFloatHistogram(hp)
} else {
fh = prompb.HistogramProtoToFloatHistogram(hp)
}

series.Histograms = append(series.Histograms, promql.HPoint{
T: h.Timestamp,
H: prompb.HistogramProtoToFloatHistogram(h),
T: hp.Timestamp,
H: fh,
})
}
result = append(result, series)
Expand Down

0 comments on commit edbc7ca

Please sign in to comment.