Skip to content

Commit

Permalink
Add query filtering to the tailer (#5969)
Browse files Browse the repository at this point in the history
* Add some comments

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>

* Use deletes in tail

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>

* Change error message

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
  • Loading branch information
MichelHollands authored Apr 21, 2022
1 parent 7299e3b commit ef56b73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,19 @@ func (q *SingleTenantQuerier) Tail(ctx context.Context, req *logproto.TailReques
return nil, err
}

deletes, err := q.deletesForUser(ctx, req.Start, time.Now())
if err != nil {
return nil, err
}

histReq := logql.SelectLogParams{
QueryRequest: &logproto.QueryRequest{
Selector: req.Query,
Start: req.Start,
End: time.Now(),
Limit: req.Limit,
Direction: logproto.BACKWARD,
Deletes: deletes,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (dm *DeleteRequestHandler) AddDeleteRequestHandler(w http.ResponseWriter, r
}

if endTime > int64(model.Now()) {
http.Error(w, "deletes in future not allowed", http.StatusBadRequest)
http.Error(w, "deletes in the future are not allowed", http.StatusBadRequest)
return
}
}
Expand Down

0 comments on commit ef56b73

Please sign in to comment.