Skip to content

Commit

Permalink
fix: show 200 status code for successful queries
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Sep 18, 2024
1 parent a26416d commit e9908f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions cmd/loki/loki-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ common:
kvstore:
store: inmemory

ingester_rf1:
enabled: false

query_range:
results_cache:
cache:
Expand Down
6 changes: 5 additions & 1 deletion pkg/logql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"flag"
"fmt"
"net/http"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -264,7 +265,10 @@ func (q *query) Exec(ctx context.Context) (logqlmodel.Result, error) {
statResult := statsCtx.Result(time.Since(start), queueTime, q.resultLength(data))
sp.LogKV(statResult.KVList()...)

status, _ := server.ClientHTTPStatusAndError(err)
status := http.StatusOK
if err != nil {
status, _ = server.ClientHTTPStatusAndError(err)
}

if q.record {
RecordRangeAndInstantQueryMetrics(ctx, q.logger, q.params, strconv.Itoa(status), statResult, data)
Expand Down

0 comments on commit e9908f4

Please sign in to comment.