Skip to content

Commit fecea5b

Browse files
authored
Add extra details to query spans. (#2636)
* Log min/max time, matchers. Signed-off-by: Peter Štibraný <[email protected]> * Add tracing to series set to see how until when series set is iterated. Signed-off-by: Peter Štibraný <[email protected]> * Log labels of iterated series, and current series and samples counts. Signed-off-by: Peter Štibraný <[email protected]> * Don't log all series, only every 100th, to avoid creating too many logs. Signed-off-by: Peter Štibraný <[email protected]> * Removed tracing_set, as it proved to be useless. Signed-off-by: Peter Štibraný <[email protected]> * Move matchers logging to querier.go. Signed-off-by: Peter Štibraný <[email protected]>
1 parent 6fec92a commit fecea5b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pkg/querier/block.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"math"
66
"sort"
77

8+
"github.com/go-kit/kit/log/level"
89
"github.com/pkg/errors"
910
"github.com/prometheus/client_golang/prometheus"
1011
"github.com/prometheus/prometheus/pkg/labels"
@@ -108,9 +109,9 @@ func (b *blocksQuerier) Select(_ bool, sp *storage.SelectHints, matchers ...*lab
108109
return nil, nil, promql.ErrStorage{Err: err}
109110
}
110111

111-
return &blockQuerierSeriesSet{
112-
series: series,
113-
}, warnings, nil
112+
level.Debug(log).Log("series", len(series), "warnings", len(warnings))
113+
114+
return &blockQuerierSeriesSet{series: series}, warnings, nil
114115
}
115116

116117
func convertMatchersToLabelMatcher(matchers []*labels.Matcher) []storepb.LabelMatcher {

pkg/querier/querier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (q querier) Select(_ bool, sp *storage.SelectHints, matchers ...*labels.Mat
247247
defer log.Span.Finish()
248248

249249
if sp != nil {
250-
level.Debug(log).Log("start", util.TimeFromMillis(sp.Start).UTC().String(), "end", util.TimeFromMillis(sp.End).UTC().String(), "step", sp.Step)
250+
level.Debug(log).Log("start", util.TimeFromMillis(sp.Start).UTC().String(), "end", util.TimeFromMillis(sp.End).UTC().String(), "step", sp.Step, "matchers", matchers)
251251
}
252252

253253
// Kludge: Prometheus passes nil SelectHints if it is doing a 'series' operation,

0 commit comments

Comments
 (0)