diff --git a/docs/sources/query/template_functions.md b/docs/sources/query/template_functions.md index 0d2097a0fc231..5b660fa786da8 100644 --- a/docs/sources/query/template_functions.md +++ b/docs/sources/query/template_functions.md @@ -470,7 +470,7 @@ Signature: `min(a interface{}, i ...interface{}) int64` Example: ```template -{{ max 1 2 3 }} //output 1 +{{ min 1 2 3 }} //output 1 ``` ## maxf diff --git a/pkg/logql/shardmapper.go b/pkg/logql/shardmapper.go index 4bee2616bf036..baa26a2a69c74 100644 --- a/pkg/logql/shardmapper.go +++ b/pkg/logql/shardmapper.go @@ -338,11 +338,7 @@ var rangeMergeMap = map[string]string{ func (m ShardMapper) mapRangeAggregationExpr(expr *syntax.RangeAggregationExpr, r *downstreamRecorder) (syntax.SampleExpr, uint64, error) { if !expr.Shardable() { - exprStats, err := m.shards.GetStats(expr) - if err != nil { - return nil, 0, err - } - return expr, exprStats.Bytes, nil + return m.noOp(expr) } switch expr.Operation { @@ -437,7 +433,7 @@ func (m ShardMapper) mapRangeAggregationExpr(expr *syntax.RangeAggregationExpr, return nil, 0, err } if shards == 0 || !m.quantileOverTimeSharding { - return m.mapSampleExpr(expr, r) + return m.noOp(expr) } // quantile_over_time() by (foo) -> @@ -465,12 +461,16 @@ func (m ShardMapper) mapRangeAggregationExpr(expr *syntax.RangeAggregationExpr, default: // don't shard if there's not an appropriate optimization - exprStats, err := m.shards.GetStats(expr) - if err != nil { - return nil, 0, err - } - return expr, exprStats.Bytes, nil + return m.noOp(expr) + } +} + +func (m ShardMapper) noOp(expr *syntax.RangeAggregationExpr) (syntax.SampleExpr, uint64, error) { + exprStats, err := m.shards.GetStats(expr) + if err != nil { + return nil, 0, err } + return expr, exprStats.Bytes, nil } func badASTMapping(got syntax.Expr) error { diff --git a/pkg/logql/shardmapper_test.go b/pkg/logql/shardmapper_test.go index 517fb1aedb42a..7e9ca7481e286 100644 --- a/pkg/logql/shardmapper_test.go +++ b/pkg/logql/shardmapper_test.go @@ -418,7 +418,7 @@ func TestMappingStrings(t *testing.T) { } func TestMapping(t *testing.T) { - m := NewShardMapper(ConstantShards(2), nilShardMetrics, []string{ShardQuantileOverTime}) + m := NewShardMapper(ConstantShards(2), nilShardMetrics, []string{}) for _, tc := range []struct { in string @@ -1340,6 +1340,25 @@ func TestMapping(t *testing.T) { }, }, }, + { + in: `quantile_over_time(0.8, {foo="bar"} | unwrap bytes [5m]) by (cluster)`, + expr: &syntax.RangeAggregationExpr{ + Operation: syntax.OpRangeTypeQuantile, + Params: float64p(0.8), + Left: &syntax.LogRange{ + Left: &syntax.MatchersExpr{ + Mts: []*labels.Matcher{mustNewMatcher(labels.MatchEqual, "foo", "bar")}, + }, + Unwrap: &syntax.UnwrapExpr{ + Identifier: "bytes", + }, + Interval: 5 * time.Minute, + }, + Grouping: &syntax.Grouping{ + Groups: []string{"cluster"}, + }, + }, + }, } { t.Run(tc.in, func(t *testing.T) { ast, err := syntax.ParseExpr(tc.in) @@ -1420,3 +1439,7 @@ func TestStringTrimming(t *testing.T) { }) } } + +func float64p(v float64) *float64 { + return &v +} diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 626523e1bae4d..ca04f5d18ce5d 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang [//]: # ( : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.) +## 5.41.5 + +- [BUGFIX] Added "swift" type object storage to resolve Loki HELM Chart error. + ## 5.41.4 - [CHANGE] Use `/ingester/shutdown?terminate=false` for write `preStop` hook diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index 095e2745a364a..1e08c0c8f0d1e 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -3,7 +3,7 @@ name: loki description: Helm chart for Grafana Loki in simple, scalable mode type: application appVersion: 2.9.3 -version: 5.41.4 +version: 5.41.5 home: https://grafana.github.io/helm-charts sources: - https://github.com/grafana/loki diff --git a/production/helm/loki/README.md b/production/helm/loki/README.md index 2857f553e13f7..ec3360d378d76 100644 --- a/production/helm/loki/README.md +++ b/production/helm/loki/README.md @@ -1,6 +1,6 @@ # loki -![Version: 5.41.4](https://img.shields.io/badge/Version-5.41.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.3](https://img.shields.io/badge/AppVersion-2.9.3-informational?style=flat-square) +![Version: 5.41.5](https://img.shields.io/badge/Version-5.41.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.3](https://img.shields.io/badge/AppVersion-2.9.3-informational?style=flat-square) Helm chart for Grafana Loki in simple, scalable mode diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl index 08e4dd063babe..9ebcc63519573 100644 --- a/production/helm/loki/templates/_helpers.tpl +++ b/production/helm/loki/templates/_helpers.tpl @@ -597,7 +597,7 @@ Create the service endpoint including port for MinIO. {{/* Determine if deployment is using object storage */}} {{- define "loki.isUsingObjectStorage" -}} -{{- or (eq .Values.loki.storage.type "gcs") (eq .Values.loki.storage.type "s3") (eq .Values.loki.storage.type "azure") -}} +{{- or (eq .Values.loki.storage.type "gcs") (eq .Values.loki.storage.type "s3") (eq .Values.loki.storage.type "azure") (eq .Values.loki.storage.type "swift") -}} {{- end -}} {{/* Configure the correct name for the memberlist service */}}