Skip to content

Commit

Permalink
log url decoded query
Browse files Browse the repository at this point in the history
  • Loading branch information
electron0zero committed Jan 23, 2023
1 parent 4449b28 commit 27af7cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/frontend/searchsharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -229,9 +230,11 @@ func (s searchSharder) RoundTrip(r *http.Request) (*http.Response, error) {
throughput := float64(overallResponse.resultsMetrics.InspectedBytes) / reqTime.Seconds()
var statusCode int

query, _ := url.PathUnescape(r.URL.RawQuery)
span.SetTag("query", query)
level.Info(s.logger).Log(
"msg", "sharded search query request stats",
"raw_query", r.URL.RawQuery,
"query", query,
"duration_seconds", reqTime,
"request_throughput", throughput,
"total_requests", len(reqs),
Expand All @@ -249,7 +252,7 @@ func (s searchSharder) RoundTrip(r *http.Request) (*http.Response, error) {

level.Info(s.logger).Log(
"msg", "sharded search query SearchMetrics",
"raw_query", r.URL.RawQuery,
"query", query,
"inspectedBlocks", overallResponse.resultsMetrics.InspectedBlocks,
"skippedBlocks", overallResponse.resultsMetrics.SkippedBlocks,
"inspectedBytes", overallResponse.resultsMetrics.InspectedBytes,
Expand Down

0 comments on commit 27af7cc

Please sign in to comment.