Skip to content
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9b4bf10
Adding support for anchored and smoothed range selectors
tcp13equals2 Nov 7, 2025
4bc430c
Update CHANGELOG.md
tcp13equals2 Nov 7, 2025
60909cd
Fix upstream tests file
tcp13equals2 Nov 7, 2025
3f66e89
Update extended_vectors.test
tcp13equals2 Nov 7, 2025
3dd1f0e
Update data.go
tcp13equals2 Nov 7, 2025
1c7b40c
Re-use the view
tcp13equals2 Nov 7, 2025
9871e70
Merge remote-tracking branch 'origin/main' into support_anchored_smoo…
tcp13equals2 Nov 7, 2025
61ca856
Update anchored.test
tcp13equals2 Nov 7, 2025
3fa4ea4
Fix tests
tcp13equals2 Nov 7, 2025
44b9386
Update astmapper.go
tcp13equals2 Nov 7, 2025
7c49f22
Address PR feedback
tcp13equals2 Nov 10, 2025
0b32e52
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 10, 2025
770065d
Update smoothed.test
tcp13equals2 Nov 10, 2025
e8f0546
Merge branch 'support_anchored_smoothed_selectors' of https://github.…
tcp13equals2 Nov 10, 2025
0bf73de
Update extend_range_vector.go
tcp13equals2 Nov 10, 2025
9b48285
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 11, 2025
6ffb7ed
Address PR feedback and add new CLI arg for enabling extended range s…
tcp13equals2 Nov 11, 2025
8599e17
Update extended_vectors.test
tcp13equals2 Nov 11, 2025
2eb8e88
Cursor tips
tcp13equals2 Nov 11, 2025
ae3b216
Update engine_test.go
tcp13equals2 Nov 11, 2025
aff095a
Feedback
tcp13equals2 Nov 11, 2025
c3cfc54
Updated cli help
tcp13equals2 Nov 11, 2025
69c0579
TestConfigDescriptorIsUpToDate
tcp13equals2 Nov 11, 2025
4f39452
Update rate_increase.go
tcp13equals2 Nov 11, 2025
6889720
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 12, 2025
df203a4
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 13, 2025
301b080
Address feedback
tcp13equals2 Nov 13, 2025
32a386d
Address PR comments
tcp13equals2 Nov 14, 2025
21c2c68
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 14, 2025
aab7240
Rename
tcp13equals2 Nov 14, 2025
70f54a8
PR feedback
tcp13equals2 Nov 17, 2025
203ca26
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 17, 2025
c9fc390
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 17, 2025
e30860b
Adding benchmarks
tcp13equals2 Nov 17, 2025
a255009
PR comments
tcp13equals2 Nov 17, 2025
9af05b7
WIP
tcp13equals2 Nov 17, 2025
ded6eb2
Update range_vector_selector.go
tcp13equals2 Nov 19, 2025
e9ec612
Update CHANGELOG.md
tcp13equals2 Nov 19, 2025
b3661bf
Update cmd/mimir/help-all.txt.tmpl
tcp13equals2 Nov 19, 2025
59b9c3a
Update fpoint_ring_buffer.go
tcp13equals2 Nov 19, 2025
5678662
Merge branch 'support_anchored_smoothed_selectors' of https://github.…
tcp13equals2 Nov 19, 2025
e6bf106
Change `FPointRingBufferView` methods to pointer receivers
charleskorn Nov 19, 2025
7789110
Inline comparisons in `CopyRemainingPointsTo`
charleskorn Nov 19, 2025
55da28b
Inline `HasNext` in `Seek`
charleskorn Nov 19, 2025
5037d74
Remove superfluous check in `Peek` already covered by `PointAt`
charleskorn Nov 19, 2025
98dc6df
Remove more superfluous checks already covered by `PointAt`
charleskorn Nov 19, 2025
31da47e
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 20, 2025
c5fe900
Merge branch 'main' into support_anchored_smoothed_selectors
tcp13equals2 Nov 24, 2025
f85e851
Update CHANGELOG.md
tcp13equals2 Nov 27, 2025
44919e5
Address PR feedback
tcp13equals2 Nov 27, 2025
6e831b5
Merge branch 'support_anchored_smoothed_selectors' of https://github.…
tcp13equals2 Nov 27, 2025
7b28b8c
Update help-all.txt.tmpl
tcp13equals2 Nov 27, 2025
bd26e26
Minor performance tweaks
tcp13equals2 Nov 27, 2025
c2cd75c
Lint
tcp13equals2 Nov 27, 2025
b6757b7
Merge remote-tracking branch 'origin/charleskorn/smoothed-anchored' i…
tcp13equals2 Nov 27, 2025
2c4e959
PR feedback
tcp13equals2 Nov 28, 2025
d7e6f1f
Update smoothed.test
tcp13equals2 Nov 28, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* [FEATURE] Query-frontends: Automatically adjust features used in query plans generated for remote execution based on what the available queriers support. #13017 #13164
* [FEATURE] Memberlist: Add experimental support for zone-aware routing, in order to reduce memberlist cross-AZ data transfer. #13129
* [FEATURE] Query-frontend and querier: Add experimental support for performing query planning in query-frontends and distributing portions of the plan to queriers for execution. #13058
* [FEATURE] MQE: Add support for experimental extended range selector modifiers `smoothed` and `anchored`. #13398
* [FEATURE] Querier: Add `querier.mimir-query-engine.enable-reduce-matchers` flag that enables a new MQE AST optimization pass that eliminates duplicate or redundant matchers that are part of selector expressions. #13178
* [ENHANCEMENT] Compactor, Store-gateway: Change default value of `-compactor.upload-sparse-index-headers` to `true`. This improves lazy loading performance in the store-gateway. #13089
* [ENHANCEMENT] Store-gateway: Verify CRC32 checksums for 1 out of every 128 chunks read from object storage and the chunks cache to detect corruption. #13151
Expand Down
1 change: 1 addition & 0 deletions docs/sources/mimir/configure/about-versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ The following features are currently experimental:
- Remote execution of queries in queriers: `-query-frontend.enable-remote-execution=true`
- Performing query sharding within MQE: `-query-frontend.use-mimir-query-engine-for-sharding=true`
- Rewriting of queries to optimize processing: `-query-frontend.rewrite-histogram-queries` and `-query-frontend.rewrite-propagate-matchers`
- Enable experimental Prometheus extended range selector modifiers `smoothed` and `anchored`. Note that this flag is shared with enabling experimental Prometheus functions (`-query-frontend.enabled-promql-experimental-functions=smoothed, anchored, ...`)
- Query-scheduler
- `-query-scheduler.querier-forget-delay`
- Store-gateway
Expand Down
2 changes: 2 additions & 0 deletions pkg/frontend/querymiddleware/astmapper/astmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ func cloneExpr(expr parser.Expr) (parser.Expr, error) {
LabelMatchers: matchers,
BypassEmptyMatcherCheck: e.BypassEmptyMatcherCheck,
PosRange: e.PosRange,
Anchored: e.Anchored,
Smoothed: e.Smoothed,
}, nil

case *parser.MatrixSelector:
Expand Down
9 changes: 9 additions & 0 deletions pkg/frontend/querymiddleware/astmapper/astmapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ func TestCloneExpr(t *testing.T) {
`foo and bar`,
`foo == bar`,
`foo == bool bar`,

// Range modifiers
`metric[1m] anchored`,
`metric[1m] smoothed`,
`rate(metric[1m] anchored)`,
`increase(metric[1m] smoothed)`,
}

for i, tc := range testCases {
Expand Down Expand Up @@ -245,11 +251,14 @@ func loadTestExpressionsFromDirectory(t *testing.T, dir string, accumulatedExpre
func enableExperimentalParserFeaturesDuringTest(t *testing.T) {
oldDurationExpressions := parser.ExperimentalDurationExpr
oldExperimentalFunctions := parser.EnableExperimentalFunctions
oldEnableExtendedRangeSelectors := parser.EnableExtendedRangeSelectors
parser.ExperimentalDurationExpr = true
parser.EnableExperimentalFunctions = true
parser.EnableExtendedRangeSelectors = true
t.Cleanup(func() {
parser.ExperimentalDurationExpr = oldDurationExpressions
parser.EnableExperimentalFunctions = oldExperimentalFunctions
parser.EnableExtendedRangeSelectors = oldEnableExtendedRangeSelectors
})
}

Expand Down
12 changes: 12 additions & 0 deletions pkg/frontend/querymiddleware/experimental_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ func containedExperimentalFunctions(expr parser.Expr) map[string]struct{} {
if n.Op.IsExperimentalAggregator() {
expFuncNames[n.Op.String()] = struct{}{}
}
case *parser.MatrixSelector:
// technically anchored & smoothed are range selectors not functions
vs, ok := n.VectorSelector.(*parser.VectorSelector)
if ok && vs.Anchored {
expFuncNames["anchored"] = struct{}{}
} else if ok && vs.Smoothed {
expFuncNames["smoothed"] = struct{}{}
}
case *parser.VectorSelector:
if n.Smoothed {
expFuncNames["smoothed"] = struct{}{}
}
}
return nil
})
Expand Down
26 changes: 25 additions & 1 deletion pkg/frontend/querymiddleware/experimental_functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import (
)

func TestContainedExperimentalFunctions(t *testing.T) {
t.Cleanup(func() { parser.EnableExperimentalFunctions = false })
t.Cleanup(func() {
parser.EnableExperimentalFunctions = false
parser.EnableExtendedRangeSelectors = false
})
parser.EnableExperimentalFunctions = true
parser.EnableExtendedRangeSelectors = true

testCases := map[string]struct {
query string
Expand Down Expand Up @@ -48,6 +52,26 @@ func TestContainedExperimentalFunctions(t *testing.T) {
query: `limit_ratio(0.5, mad_over_time(up[5m]))`,
expect: []string{"limit_ratio", "mad_over_time"},
},
"metric smoothed": {
query: `metric smoothed`,
expect: []string{"smoothed"},
},
"metric[1m] smoothed": {
query: `metric[1m] smoothed`,
expect: []string{"smoothed"},
},
"metric[1m] anchored": {
query: `metric[1m] anchored`,
expect: []string{"anchored"},
},
"rate(metric[1m] smoothed)": {
query: `rate(metric[1m] smoothed)`,
expect: []string{"smoothed"},
},
"increase(metric[1m] anchored)": {
query: `increase(metric[1m] anchored)`,
expect: []string{"anchored"},
},
}

for name, tc := range testCases {
Expand Down
3 changes: 3 additions & 0 deletions pkg/frontend/querymiddleware/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ func newQueryTripperware(
// This enables duration arithmetic https://github.com/prometheus/prometheus/pull/16249.
parser.ExperimentalDurationExpr = true

// This enables the anchored and smoothed selector modifiers
parser.EnableExtendedRangeSelectors = true

var c cache.Cache
if cfg.CacheResults || cfg.cardinalityBasedShardingEnabled() {
var err error
Expand Down
3 changes: 3 additions & 0 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ func New(cfg Config, limits *validation.Overrides, distributor Distributor, quer
// This enables duration arithmetic https://github.com/prometheus/prometheus/pull/16249.
parser.ExperimentalDurationExpr = true

// This enables the anchored and smoothed selector modifiers
parser.EnableExtendedRangeSelectors = true

var eng promql.QueryEngine
var streamingEngine *streamingpromql.Engine

Expand Down
Loading
Loading