Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,18 @@ func TestPromqlAcceptance(t *testing.T) {
NoStepSubqueryIntervalFn: func(rangeMillis int64) int64 { return 30 * time.Second.Milliseconds() },
}})

// TODO(mhoffmann): we cannot skip at individual test level yet, only full test files
// it would be great if we could just skip individual tests here for features we dont
// want to support.
st := &skipTest{
skipTests: []string{
"testdata/name_label_dropping.test", // feature unsupported
"testdata/type_and_unit.test", // feature unsupported
}, // TODO(sungjin1212): change to test whole cases
"testdata/limit.test", // limitk, limit_ratio
"testdata/at_modifier.test", // missing counter annotations
},
TBRun: t,
}

promqltest.RunBuiltinTests(st, engine)
}

Expand Down
26 changes: 0 additions & 26 deletions storage/prometheus/matrix_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import (
"context"
"fmt"
"math"
"strings"
"sync"
"time"

"github.com/thanos-io/promql-engine/execution/model"
"github.com/thanos-io/promql-engine/execution/parse"
"github.com/thanos-io/promql-engine/execution/telemetry"
"github.com/thanos-io/promql-engine/execution/warnings"
"github.com/thanos-io/promql-engine/extlabels"
"github.com/thanos-io/promql-engine/query"
"github.com/thanos-io/promql-engine/ringbuffer"
Expand All @@ -23,9 +21,7 @@ import (
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/value"
"github.com/prometheus/prometheus/promql/parser/posrange"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/util/annotations"
)

type matrixScanner struct {
Expand Down Expand Up @@ -71,9 +67,6 @@ type matrixSelector struct {

// Lookback delta for extended range functions.
extLookbackDelta int64

nonCounterMetric string
hasFloats bool
}

var ErrNativeHistogramsNotSupported = errors.New("native histograms are not supported in extended range functions")
Expand Down Expand Up @@ -154,10 +147,6 @@ func (o *matrixSelector) Next(ctx context.Context) ([]model.StepVector, error) {
}

if o.currentStep > o.maxt {
if o.nonCounterMetric != "" && o.hasFloats {
warnings.AddToContext(annotations.NewPossibleNonCounterInfo(o.nonCounterMetric, posrange.PositionRange{}), ctx)
}

return nil, nil
}
if err := o.loadSeries(ctx); err != nil {
Expand Down Expand Up @@ -200,7 +189,6 @@ func (o *matrixSelector) Next(ctx context.Context) ([]model.StepVector, error) {
vectors[currStep].AppendHistogram(o.vectorPool, scanner.signature, h)
} else {
vectors[currStep].AppendSample(o.vectorPool, scanner.signature, f)
o.hasFloats = true
}
}
o.telemetry.IncrementSamplesAtTimestamp(scanner.buffer.SampleCount(), seriesTs)
Expand Down Expand Up @@ -252,20 +240,6 @@ func (o *matrixSelector) loadSeries(ctx context.Context) error {
o.seriesBatchSize = numSeries
}
o.vectorPool.SetStepSize(int(o.seriesBatchSize))

// Add a warning if rate or increase is applied on metrics which are not named like counters.
if o.functionName == "rate" || o.functionName == "increase" {
if len(series) > 0 {
metricName := series[0].Labels().Get(labels.MetricName)
if metricName != "" &&
!strings.HasSuffix(metricName, "_total") &&
!strings.HasSuffix(metricName, "_sum") &&
!strings.HasSuffix(metricName, "_count") &&
!strings.HasSuffix(metricName, "_bucket") {
o.nonCounterMetric = metricName
}
}
}
})
return err
}
Expand Down
Loading