Browse Source

Handle native histograms in remote read

Signed-off-by: Justin Lei <justin.lei@grafana.com>
pull/12085/head
Justin Lei 2 years ago
parent
commit
c16b6a0185
  1. 152
      prompb/types.pb.go
  2. 7
      prompb/types.proto
  3. 31
      promql/test.go
  4. 36
      storage/remote/codec.go
  5. 73
      storage/remote/read_handler_test.go
  6. 4
      storage/remote/read_test.go

152
prompb/types.pb.go

@ -134,21 +134,24 @@ func (LabelMatcher_Type) EnumDescriptor() ([]byte, []int) {
type Chunk_Encoding int32 type Chunk_Encoding int32
const ( const (
Chunk_UNKNOWN Chunk_Encoding = 0 Chunk_UNKNOWN Chunk_Encoding = 0
Chunk_XOR Chunk_Encoding = 1 Chunk_XOR Chunk_Encoding = 1
Chunk_HISTOGRAM Chunk_Encoding = 2 Chunk_HISTOGRAM Chunk_Encoding = 2
Chunk_FLOAT_HISTOGRAM Chunk_Encoding = 3
) )
var Chunk_Encoding_name = map[int32]string{ var Chunk_Encoding_name = map[int32]string{
0: "UNKNOWN", 0: "UNKNOWN",
1: "XOR", 1: "XOR",
2: "HISTOGRAM", 2: "HISTOGRAM",
3: "FLOAT_HISTOGRAM",
} }
var Chunk_Encoding_value = map[string]int32{ var Chunk_Encoding_value = map[string]int32{
"UNKNOWN": 0, "UNKNOWN": 0,
"XOR": 1, "XOR": 1,
"HISTOGRAM": 2, "HISTOGRAM": 2,
"FLOAT_HISTOGRAM": 3,
} }
func (x Chunk_Encoding) String() string { func (x Chunk_Encoding) String() string {
@ -1143,75 +1146,76 @@ func init() {
func init() { proto.RegisterFile("types.proto", fileDescriptor_d938547f84707355) } func init() { proto.RegisterFile("types.proto", fileDescriptor_d938547f84707355) }
var fileDescriptor_d938547f84707355 = []byte{ var fileDescriptor_d938547f84707355 = []byte{
// 1081 bytes of a gzipped FileDescriptorProto // 1092 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdb, 0x6e, 0x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 0x7f, 0x70, 0xef, 0xe4, 0x62,
0xe7, 0xff, 0xb5, 0xcb, 0x0e, 0xc0, 0x9c, 0xa9, 0x0c, 0x79, 0x93, 0xed, 0xde, 0x12, 0x9e, 0x07, 0x70, 0x38, 0x1a, 0x17, 0x1e, 0x5b, 0xf7, 0x07, 0x68, 0x60, 0x46, 0x3e, 0xfd, 0xaf, 0xad, 0xb7,
0xa4, 0xb4, 0xa3, 0xbd, 0x37, 0x37, 0xfb, 0xda, 0xef, 0x37, 0xfb, 0xda, 0x9f, 0x37, 0xfb, 0xda, 0x0f, 0xe6, 0x44, 0xed, 0x90, 0x75, 0xde, 0xf6, 0x9d, 0xaf, 0xc9, 0x02, 0x12, 0xda, 0xd1, 0xce,
0xf7, 0xa6, 0x62, 0xc7, 0x97, 0x97, 0x26, 0xfe, 0xcd, 0x7c, 0xf6, 0x77, 0x00, 0x00, 0x00, 0xff, 0x9b, 0xdb, 0x3d, 0xed, 0xb7, 0xdb, 0x3d, 0xed, 0xcf, 0xdb, 0x3d, 0xed, 0x7b, 0x53, 0xb1, 0xa3,
0xff, 0x53, 0x09, 0xe5, 0x37, 0xfe, 0x08, 0x00, 0x00, 0xab, 0x2b, 0x13, 0x7f, 0x71, 0x3e, 0xff, 0x3b, 0x00, 0x00, 0xff, 0xff, 0xfb, 0x5f, 0xf2, 0x4d,
0x13, 0x09, 0x00, 0x00,
} }
func (m *MetricMetadata) Marshal() (dAtA []byte, err error) { func (m *MetricMetadata) Marshal() (dAtA []byte, err error) {

7
prompb/types.proto

@ -169,9 +169,10 @@ message Chunk {
// We require this to match chunkenc.Encoding. // We require this to match chunkenc.Encoding.
enum Encoding { enum Encoding {
UNKNOWN = 0; UNKNOWN = 0;
XOR = 1; XOR = 1;
HISTOGRAM = 2; HISTOGRAM = 2;
FLOAT_HISTOGRAM = 3;
} }
Encoding type = 3; Encoding type = 3;
bytes data = 4; bytes data = 4;

31
promql/test.go

@ -33,6 +33,7 @@ import (
"github.com/prometheus/prometheus/promql/parser" "github.com/prometheus/prometheus/promql/parser"
"github.com/prometheus/prometheus/storage" "github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb" "github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/tsdb/tsdbutil"
"github.com/prometheus/prometheus/util/teststorage" "github.com/prometheus/prometheus/util/teststorage"
"github.com/prometheus/prometheus/util/testutil" "github.com/prometheus/prometheus/util/testutil"
) )
@ -302,14 +303,26 @@ func (cmd loadCmd) String() string {
func (cmd *loadCmd) set(m labels.Labels, vals ...parser.SequenceValue) { func (cmd *loadCmd) set(m labels.Labels, vals ...parser.SequenceValue) {
h := m.Hash() h := m.Hash()
metricName := m.Get("__name__")
isHistogram := strings.Contains(metricName, "_histogram_")
samples := make([]Point, 0, len(vals)) samples := make([]Point, 0, len(vals))
ts := testStartTime ts := testStartTime
for _, v := range vals { for _, v := range vals {
if !v.Omitted { if !v.Omitted {
samples = append(samples, Point{ t := ts.UnixNano() / int64(time.Millisecond/time.Nanosecond)
T: ts.UnixNano() / int64(time.Millisecond/time.Nanosecond),
V: v.Value, if isHistogram {
}) samples = append(samples, Point{
T: t,
H: tsdbutil.GenerateTestFloatHistogram(int(v.Value)),
})
} else {
samples = append(samples, Point{
T: t,
V: v.Value,
})
}
} }
ts = ts.Add(cmd.gap) ts = ts.Add(cmd.gap)
} }
@ -323,8 +336,14 @@ func (cmd *loadCmd) append(a storage.Appender) error {
m := cmd.metrics[h] m := cmd.metrics[h]
for _, s := range smpls { for _, s := range smpls {
if _, err := a.Append(0, m, s.T, s.V); err != nil { if s.H == nil {
return err if _, err := a.Append(0, m, s.T, s.V); err != nil {
return err
}
} else {
if _, err := a.AppendHistogram(0, m, s.T, nil, s.H); err != nil {
return err
}
} }
} }
} }

36
storage/remote/codec.go

@ -120,10 +120,13 @@ func ToQueryResult(ss storage.SeriesSet, sampleLimit int) (*prompb.QueryResult,
for ss.Next() { for ss.Next() {
series := ss.At() series := ss.At()
iter = series.Iterator(iter) iter = series.Iterator(iter)
samples := []prompb.Sample{}
for iter.Next() == chunkenc.ValFloat { var (
// TODO(beorn7): Add Histogram support. samples []prompb.Sample
histograms []prompb.Histogram
)
for valType := iter.Next(); valType != chunkenc.ValNone; valType = iter.Next() {
numSamples++ numSamples++
if sampleLimit > 0 && numSamples > sampleLimit { if sampleLimit > 0 && numSamples > sampleLimit {
return nil, ss.Warnings(), HTTPError{ return nil, ss.Warnings(), HTTPError{
@ -131,19 +134,32 @@ func ToQueryResult(ss storage.SeriesSet, sampleLimit int) (*prompb.QueryResult,
status: http.StatusBadRequest, status: http.StatusBadRequest,
} }
} }
ts, val := iter.At()
samples = append(samples, prompb.Sample{ switch valType {
Timestamp: ts, case chunkenc.ValFloat:
Value: val, ts, val := iter.At()
}) samples = append(samples, prompb.Sample{
Timestamp: ts,
Value: val,
})
case chunkenc.ValHistogram:
ts, h := iter.AtHistogram()
histograms = append(histograms, HistogramToHistogramProto(ts, h))
case chunkenc.ValFloatHistogram:
ts, fh := iter.AtFloatHistogram()
histograms = append(histograms, FloatHistogramToHistogramProto(ts, fh))
default:
return nil, ss.Warnings(), fmt.Errorf("unrecognized value type: %s", valType)
}
} }
if err := iter.Err(); err != nil { if err := iter.Err(); err != nil {
return nil, ss.Warnings(), err return nil, ss.Warnings(), err
} }
resp.Timeseries = append(resp.Timeseries, &prompb.TimeSeries{ resp.Timeseries = append(resp.Timeseries, &prompb.TimeSeries{
Labels: labelsToLabelsProto(series.Labels(), nil), Labels: labelsToLabelsProto(series.Labels(), nil),
Samples: samples, Samples: samples,
Histograms: histograms,
}) })
} }
return resp, ss.Warnings(), ss.Err() return resp, ss.Warnings(), ss.Err()

73
storage/remote/read_handler_test.go

File diff suppressed because one or more lines are too long

4
storage/remote/read_test.go

@ -171,12 +171,12 @@ func TestSeriesSetFilter(t *testing.T) {
toRemove: []string{"foo"}, toRemove: []string{"foo"},
in: &prompb.QueryResult{ in: &prompb.QueryResult{
Timeseries: []*prompb.TimeSeries{ Timeseries: []*prompb.TimeSeries{
{Labels: labelsToLabelsProto(labels.FromStrings("foo", "bar", "a", "b"), nil), Samples: []prompb.Sample{}}, {Labels: labelsToLabelsProto(labels.FromStrings("foo", "bar", "a", "b"), nil)},
}, },
}, },
expected: &prompb.QueryResult{ expected: &prompb.QueryResult{
Timeseries: []*prompb.TimeSeries{ Timeseries: []*prompb.TimeSeries{
{Labels: labelsToLabelsProto(labels.FromStrings("a", "b"), nil), Samples: []prompb.Sample{}}, {Labels: labelsToLabelsProto(labels.FromStrings("a", "b"), nil)},
}, },
}, },
}, },

Loading…
Cancel
Save