Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync r283 to the version actually in use in dependent project #7792

Merged
merged 9 commits into from
Apr 3, 2024
Merged
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ mimir-build-image/$(UPTODATE): mimir-build-image/*
# All the boiler plate for building golang follows:
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
BUILD_IN_CONTAINER ?= true
LATEST_BUILD_IMAGE_TAG ?= pr7557-ae15c572b6
LATEST_BUILD_IMAGE_TAG ?= pr7710-7746ee9368

# TTY is parameterized to allow Google Cloud Builder to run builds,
# as it currently disallows TTY devices. This value needs to be overridden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
# Scrape the metrics also with the Grafana agent (useful to test metadata ingestion
# until metadata remote write is not supported by Prometheus).
grafana-agent:
image: grafana/agent:v0.40.2
image: grafana/agent:v0.40.3
command: ["-config.file=/etc/agent-config/grafana-agent.yaml", "-metrics.wal-directory=/tmp", "-server.http.address=127.0.0.1:9091"]
volumes:
- ./config:/etc/agent-config
Expand Down
4 changes: 2 additions & 2 deletions development/mimir-monolithic-mode/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
grafana-agent:
profiles:
- grafana-agent-static
image: grafana/agent:v0.40.2
image: grafana/agent:v0.40.3
command: ["-config.file=/etc/agent-config/grafana-agent.yaml", "-metrics.wal-directory=/tmp", "-server.http.address=127.0.0.1:9091"]
volumes:
- ./config:/etc/agent-config
Expand All @@ -54,7 +54,7 @@ services:
grafana-agent-flow:
profiles:
- grafana-agent-flow
image: grafana/agent:v0.40.2
image: grafana/agent:v0.40.3
environment:
- AGENT_MODE=flow
command: ["run", "--server.http.listen-addr=0.0.0.0:9092", "/etc/agent/config.river"]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ require (
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/trace v1.24.0
go.uber.org/multierr v1.11.0
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81
google.golang.org/api v0.168.0
google.golang.org/protobuf v1.33.0
sigs.k8s.io/kustomize/kyaml v0.16.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 h1:6R2FC06FonbXQ8pK11/PDFY6N6LWlf9KlzibaCapmqc=
golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
Expand Down
2 changes: 1 addition & 1 deletion mimir-build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Provenance-includes-copyright: The Cortex Authors.

FROM registry.k8s.io/kustomize/kustomize:v5.3.0 as kustomize
FROM alpine/helm:3.14.2 as helm
FROM alpine/helm:3.14.3 as helm
FROM golang:1.21.8-bookworm
ARG goproxyValue
ENV GOPROXY=${goproxyValue}
Expand Down
2 changes: 1 addition & 1 deletion operations/helm/charts/mimir-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ memcached:
# -- Memcached Docker image repository
repository: memcached
# -- Memcached Docker image tag
tag: 1.6.24-alpine
tag: 1.6.25-alpine
# -- Memcached Docker image pull policy
pullPolicy: IfNotPresent

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
secretName: tls-certs
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
secretName: tls-certs
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
secretName: tls-certs
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
secretName: tls-certs
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
terminationGracePeriodSeconds: 60
containers:
- name: memcached
image: memcached:1.6.24-alpine
image: memcached:1.6.25-alpine
imagePullPolicy: IfNotPresent
resources:
limits: null
Expand Down
15 changes: 11 additions & 4 deletions pkg/frontend/querymiddleware/results_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,20 @@ type CacheKeyGenerator interface {

type DefaultCacheKeyGenerator struct {
codec Codec
// Interval is a constant split Interval when determining cache keys for QueryRequest.
Interval time.Duration
// interval is a constant split interval when determining cache keys for QueryRequest.
interval time.Duration
}

// QueryRequest generates a cache key based on the userID, Request and Interval.
func NewDefaultCacheKeyGenerator(codec Codec, interval time.Duration) DefaultCacheKeyGenerator {
return DefaultCacheKeyGenerator{
codec: codec,
interval: interval,
}
}

// QueryRequest generates a cache key based on the userID, Request and interval.
func (g DefaultCacheKeyGenerator) QueryRequest(_ context.Context, userID string, r Request) string {
startInterval := r.GetStart() / g.Interval.Milliseconds()
startInterval := r.GetStart() / g.interval.Milliseconds()
stepOffset := r.GetStart() % r.GetStep()

// Use original format for step-aligned request, so that we can use existing cached results for such requests.
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/querymiddleware/results_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ func TestDefaultSplitter_QueryRequest(t *testing.T) {
}
for _, tt := range tests {
t.Run(fmt.Sprintf("%s - %s", tt.name, tt.interval), func(t *testing.T) {
if got := (DefaultCacheKeyGenerator{codec: codec, Interval: tt.interval}).QueryRequest(ctx, "fake", tt.r); got != tt.want {
if got := (DefaultCacheKeyGenerator{codec: codec, interval: tt.interval}).QueryRequest(ctx, "fake", tt.r); got != tt.want {
t.Errorf("generateKey() = %v, want %v", got, tt.want)
}
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/querymiddleware/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func newQueryTripperware(

cacheKeyGenerator := cfg.CacheKeyGenerator
if cacheKeyGenerator == nil {
cacheKeyGenerator = DefaultCacheKeyGenerator{codec: codec, Interval: cfg.SplitQueriesByInterval}
cacheKeyGenerator = NewDefaultCacheKeyGenerator(codec, cfg.SplitQueriesByInterval)
}

// Inject the middleware to split requests by interval + results cache (if at least one of the two is enabled).
Expand Down
Loading
Loading