Skip to content

Commit ed87c72

Browse files
committed
add logs
1 parent 3fa93a1 commit ed87c72

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/cortex/frontend/transport/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (f *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
218218
}
219219

220220
if shouldReportSlowQuery {
221-
f.reportSlowQuery(r, hs, queryString, queryResponseTime)
221+
f.reportSlowQuery(r, hs, queryString, queryBytesFetched, queryResponseTime)
222222
}
223223
if shouldReportExpensiveQuery {
224224
f.reportExpensiveQuery(r, queryString, queryBytesFetched, queryResponseTime)
@@ -287,7 +287,7 @@ func (f *Handler) reportExpensiveQuery(r *http.Request, queryString url.Values,
287287
}
288288

289289
// reportSlowQuery reports slow queries.
290-
func (f *Handler) reportSlowQuery(r *http.Request, responseHeaders http.Header, queryString url.Values, queryResponseTime time.Duration) {
290+
func (f *Handler) reportSlowQuery(r *http.Request, responseHeaders http.Header, queryString url.Values, queryBytesFetched uint64, queryResponseTime time.Duration) {
291291
f.slowQueryCount.Inc()
292292
// NOTE(GiedriusS): see https://github.com/grafana/grafana/pull/60301 for more info.
293293
grafanaDashboardUID := "-"
@@ -319,6 +319,7 @@ func (f *Handler) reportSlowQuery(r *http.Request, responseHeaders http.Header,
319319
"remote_user", remoteUser,
320320
"remote_addr", r.RemoteAddr,
321321
"time_taken", queryResponseTime.String(),
322+
"query_megabytes_fetched", queryBytesFetched / (1024 * 1024),
322323
"grafana_dashboard_uid", grafanaDashboardUID,
323324
"grafana_panel_id", grafanaPanelID,
324325
"trace_id", thanosTraceID,

0 commit comments

Comments
 (0)