Skip to content

Commit

Permalink
Update mimir-prometheus to d162bb51b6ef (#4759)
Browse files Browse the repository at this point in the history
* Update mimir-prometheus vendor to d162bb51b6ef

* Update code to work with mimir-prometheus

* Update code to work with latest mimir-prometheus commits

* Update TestQuerySharding_FunctionCorrectness
  • Loading branch information
zenador authored Apr 19, 2023
1 parent 5d9f104 commit a30761c
Show file tree
Hide file tree
Showing 72 changed files with 2,144 additions and 1,296 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ require (
)

// Using a fork of Prometheus with Mimir-specific changes.
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20230417132058-c461e223418b
replace github.com/prometheus/prometheus => github.com/grafana/mimir-prometheus v0.0.0-20230418130726-d162bb51b6ef

// Replace memberlist with our fork which includes some fixes that haven't been
// merged upstream yet:
Expand Down
6 changes: 3 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.5.1 h1:BMTdr+ib5ljLa9MxT
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.5.1/go.mod h1:c6WvOhtmjNUWbLfOG1qxM/q0SPvQNSVJvolm+C52dIU=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest/autorest v0.11.28 h1:ndAExarwr5Y+GaHE6VCaY1kyS/HwwGGyuimVhWsHOEM=
github.com/Azure/go-autorest/autorest/adal v0.9.22 h1:/GblQdIudfEM3AWWZ0mrYJQSd7JS4S/Mbzh6F0ov0Xc=
github.com/Azure/go-autorest/autorest/adal v0.9.23 h1:Yepx8CvFxwNKpH6ja7RZ+sKX+DWYNldbLiALMC3BTz8=
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk=
github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac=
Expand Down Expand Up @@ -529,8 +529,8 @@ github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 h1:WB3bGH2f1UN6
github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU=
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe h1:yIXAAbLswn7VNWBIvM71O2QsgfgW9fRXZNR0DXe6pDU=
github.com/grafana/memberlist v0.3.1-0.20220714140823-09ffed8adbbe/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/grafana/mimir-prometheus v0.0.0-20230417132058-c461e223418b h1:El+0EImX0ZSFKzy0NnvuFILGv3khlEnJmRSK58p5F9M=
github.com/grafana/mimir-prometheus v0.0.0-20230417132058-c461e223418b/go.mod h1:nOnMC6vOTtyXwYaSWAUtfqtdlxfxkQvW7niVgJqcJxY=
github.com/grafana/mimir-prometheus v0.0.0-20230418130726-d162bb51b6ef h1:jsrCY75xwUUrt9Xd2V6pP8lqhdlGrQSNzMw6dEYc2Ew=
github.com/grafana/mimir-prometheus v0.0.0-20230418130726-d162bb51b6ef/go.mod h1:7cY9a98yoTl0qTVsrHKAPzSurtekpMpjvOsG3T7OON4=
github.com/grafana/regexp v0.0.0-20221005093135-b4c2bcb0a4b6 h1:A3dhViTeFDSQcGOXuUi6ukCQSMyDtDISBp2z6OOo2YM=
github.com/grafana/regexp v0.0.0-20221005093135-b4c2bcb0a4b6/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
Expand Down
2 changes: 1 addition & 1 deletion integration/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ type sample struct {
}

func (s sample) T() int64 { return s.t }
func (s sample) V() float64 { return s.v }
func (s sample) F() float64 { return s.v }
func (s sample) H() *histogram.Histogram { return s.h }
func (s sample) FH() *histogram.FloatHistogram { return s.fh }

Expand Down
2 changes: 1 addition & 1 deletion integration/querier_remote_read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func TestQuerierStreamingRemoteRead(t *testing.T) {
ts, fh := chkItr.AtFloatHistogram()
require.Equal(t, histograms[sampleIdx].Timestamp, ts)

expected := remote.HistogramProtoToFloatHistogram(histograms[sampleIdx])
expected := remote.FloatHistogramProtoToFloatHistogram(histograms[sampleIdx])
test.RequireFloatHistogramEqual(t, expected, fh)
default:
require.Fail(t, "unrecognized value type")
Expand Down
37 changes: 14 additions & 23 deletions pkg/api/protobuf_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ func (c protobufCodec) encodeVector(v promql.Vector) mimirpb.VectorData {
samples = append(samples, mimirpb.VectorSample{
Metric: metric,
TimestampMs: s.T,
Value: s.V,
Value: s.F,
})
} else {
histograms = append(histograms, mimirpb.VectorHistogram{
Metric: metric,
TimestampMs: s.T,
Histogram: *mimirpb.FloatHistogramFromPrometheusModel(s.Point.H),
Histogram: *mimirpb.FloatHistogramFromPrometheusModel(s.H),
})
}
}
Expand All @@ -136,29 +136,20 @@ func (c protobufCodec) encodeMatrix(m promql.Matrix) mimirpb.MatrixData {
}

func (c protobufCodec) encodeMatrixSeries(s promql.Series) mimirpb.MatrixSeries {
histogramCount := 0

for _, p := range s.Points {
if p.H != nil {
histogramCount++
}
samples := make([]mimirpb.Sample, 0, len(s.Floats))
for _, p := range s.Floats {
samples = append(samples, mimirpb.Sample{
TimestampMs: p.T,
Value: p.F,
})
}

samples := make([]mimirpb.Sample, 0, len(s.Points)-histogramCount)
histograms := make([]mimirpb.FloatHistogramPair, 0, histogramCount)

for _, p := range s.Points {
if p.H == nil {
samples = append(samples, mimirpb.Sample{
TimestampMs: p.T,
Value: p.V,
})
} else {
histograms = append(histograms, mimirpb.FloatHistogramPair{
TimestampMs: p.T,
Histogram: *mimirpb.FloatHistogramFromPrometheusModel(p.H),
})
}
histograms := make([]mimirpb.FloatHistogramPair, 0, len(s.Histograms))
for _, p := range s.Histograms {
histograms = append(histograms, mimirpb.FloatHistogramPair{
TimestampMs: p.T,
Histogram: *mimirpb.FloatHistogramFromPrometheusModel(p.H),
})
}

return mimirpb.MatrixSeries{
Expand Down
Loading

0 comments on commit a30761c

Please sign in to comment.