Skip to content

Commit

Permalink
fix(indexstats): do not collect stats from "IndexStats" lookups for o…
Browse files Browse the repository at this point in the history
…ther query types (#12978)
  • Loading branch information
ashwanthgoli authored May 21, 2024
1 parent 8442dca commit 1f5291a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
2 changes: 2 additions & 0 deletions pkg/ingester/tailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"sync"
"time"

"go.uber.org/atomic"

"github.com/go-kit/log/level"
"github.com/prometheus/prometheus/model/labels"
"go.uber.org/atomic"
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

0 comments on commit 1f5291a

Please sign in to comment.