Skip to content

Commit

Permalink
Do not insert point when missing when sharding (#5444)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyriltovena authored Feb 23, 2022
1 parent 3ec0bd3 commit e3db267
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
7 changes: 0 additions & 7 deletions pkg/logql/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ func (m *MatrixStepper) Next() (bool, int64, promql.Vector) {
ln := len(series.Points)

if ln == 0 || series.Points[0].T != ts {
vec = append(vec, promql.Sample{
Point: promql.Point{
T: ts,
V: 0,
},
Metric: series.Metric,
})
continue
}

Expand Down
27 changes: 1 addition & 26 deletions pkg/logql/matrix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,12 @@ func TestMatrixStepper(t *testing.T) {
Point: promql.Point{T: start.UnixNano(), V: 0},
Metric: labels.Labels{{Name: "foo", Value: "bar"}},
},
promql.Sample{
Point: promql.Point{T: start.UnixNano(), V: 0},
Metric: labels.Labels{{Name: "bazz", Value: "buzz"}},
},
},
{
promql.Sample{
Point: promql.Point{T: start.Add(step).UnixNano() / int64(time.Millisecond), V: 1},
Metric: labels.Labels{{Name: "foo", Value: "bar"}},
},
promql.Sample{
Point: promql.Point{T: start.Add(step).UnixNano() / int64(time.Millisecond), V: 0},
Metric: labels.Labels{{Name: "bazz", Value: "buzz"}},
},
},
{
promql.Sample{
Expand All @@ -75,10 +67,6 @@ func TestMatrixStepper(t *testing.T) {
Point: promql.Point{T: start.Add(3*step).UnixNano() / int64(time.Millisecond), V: 3},
Metric: labels.Labels{{Name: "foo", Value: "bar"}},
},
promql.Sample{
Point: promql.Point{T: start.Add(3*step).UnixNano() / int64(time.Millisecond), V: 0},
Metric: labels.Labels{{Name: "bazz", Value: "buzz"}},
},
},
{
promql.Sample{
Expand All @@ -95,21 +83,8 @@ func TestMatrixStepper(t *testing.T) {
Point: promql.Point{T: start.Add(5*step).UnixNano() / int64(time.Millisecond), V: 5},
Metric: labels.Labels{{Name: "foo", Value: "bar"}},
},
promql.Sample{
Point: promql.Point{T: start.Add(5*step).UnixNano() / int64(time.Millisecond), V: 0},
Metric: labels.Labels{{Name: "bazz", Value: "buzz"}},
},
},
{
promql.Sample{
Point: promql.Point{T: start.Add(6*step).UnixNano() / int64(time.Millisecond), V: 0},
Metric: labels.Labels{{Name: "foo", Value: "bar"}},
},
promql.Sample{
Point: promql.Point{T: start.Add(6*step).UnixNano() / int64(time.Millisecond), V: 0},
Metric: labels.Labels{{Name: "bazz", Value: "buzz"}},
},
},
{},
}

for i := 0; i <= int(end.Sub(start)/step); i++ {
Expand Down

0 comments on commit e3db267

Please sign in to comment.