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

fix(indexstats): do not collect stats from "IndexStats" lookups for other query types #12978

Merged
merged 2 commits into from
May 21, 2024
Merged
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
3 changes: 2 additions & 1 deletion pkg/ingester/tailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"encoding/binary"
"hash/fnv"
"sync"
"sync/atomic"
"time"

"go.uber.org/atomic"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this relevant to fixing the panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, it was fixing faillint from this build. https://github.com/grafana/loki/actions/runs/9107236736/job/25035770691


"github.com/go-kit/log/level"
"github.com/prometheus/prometheus/model/labels"
"golang.org/x/net/context"
Expand Down
25 changes: 2 additions & 23 deletions pkg/querier/queryrange/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func NewMiddleware(
seriesRT = seriesTripperware.Wrap(next)
labelsRT = labelsTripperware.Wrap(next)
instantRT = instantMetricTripperware.Wrap(next)
statsRT = indexStatsTripperware.Wrap(next)
statsRT = base.MergeMiddlewares(StatsCollectorMiddleware(), indexStatsTripperware).Wrap(next)
seriesVolumeRT = seriesVolumeTripperware.Wrap(next)
detectedFieldsRT = detectedFieldsTripperware.Wrap(next)
detectedLabelsRT = detectedLabelsTripperware.Wrap(next)
Expand Down Expand Up @@ -1055,22 +1055,6 @@ func NewVolumeTripperware(cfg Config, log log.Logger, limits Limits, schema conf
), nil
}

func statsTripperware(nextTW base.Middleware) base.Middleware {
return base.MiddlewareFunc(func(next base.Handler) base.Handler {
return base.HandlerFunc(func(ctx context.Context, r base.Request) (base.Response, error) {
cacheMiddlewares := []base.Middleware{
StatsCollectorMiddleware(),
nextTW,
}

// wrap nextRT with our new middleware
return base.MergeMiddlewares(
cacheMiddlewares...,
).Wrap(next).Do(ctx, r)
})
})
}

func volumeRangeTripperware(nextTW base.Middleware) base.Middleware {
return base.MiddlewareFunc(func(next base.Handler) base.Handler {
return base.HandlerFunc(func(ctx context.Context, r base.Request) (base.Response, error) {
Expand Down Expand Up @@ -1141,7 +1125,7 @@ func NewIndexStatsTripperware(cfg Config, log log.Logger, limits Limits, schema
}
}

tw, err := sharedIndexTripperware(
return sharedIndexTripperware(
cacheMiddleware,
cfg,
merger,
Expand All @@ -1152,11 +1136,6 @@ func NewIndexStatsTripperware(cfg Config, log log.Logger, limits Limits, schema
schema,
metricsNamespace,
)
if err != nil {
return nil, err
}

return statsTripperware(tw), nil
}

func sharedIndexTripperware(
Expand Down
Loading