Skip to content

Commit

Permalink
fix(promhandler): close querier
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Nov 2, 2023
1 parent a98a648 commit dc56195
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/promhandler/promhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ func (h *PromAPI) GetLabelValues(ctx context.Context, params promapi.GetLabelVal
if err != nil {
return nil, executionErr("get querier", err)
}
defer func() {
_ = q.Close()
}()

// Fast path for cases when match[] is not set.
if len(sets) < 2 {
Expand Down Expand Up @@ -126,6 +129,9 @@ func (h *PromAPI) GetLabels(ctx context.Context, params promapi.GetLabelsParams)
if err != nil {
return nil, executionErr("get querier", err)
}
defer func() {
_ = q.Close()
}()

// Fast path for cases when match[] is not set.
if len(sets) < 2 {
Expand Down Expand Up @@ -334,6 +340,9 @@ func (h *PromAPI) GetSeries(ctx context.Context, params promapi.GetSeriesParams)
if err != nil {
return nil, executionErr("get querier", err)
}
defer func() {
_ = q.Close()
}()

var (
hints = &storage.SelectHints{
Expand Down

0 comments on commit dc56195

Please sign in to comment.