Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds span metadata for split queries #1567

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/querier/queryrange/split_by_interval.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (

"github.com/cortexproject/cortex/pkg/querier/queryrange"
"github.com/grafana/loki/pkg/logproto"
"github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log"
"github.com/weaveworks/common/user"
)

Expand Down Expand Up @@ -98,6 +100,10 @@ func (h *splitByInterval) Process(
func (h *splitByInterval) loop(ctx context.Context, ch <-chan *lokiResult) {

for data := range ch {

_, ctx := opentracing.StartSpanFromContext(ctx, "interval")
owen-d marked this conversation as resolved.
Show resolved Hide resolved
queryrange.LogToSpan(ctx, data.req)

resp, err := h.next.Do(ctx, data.req)
if err != nil {
data.err <- err
Expand All @@ -117,6 +123,11 @@ func (h *splitByInterval) Do(ctx context.Context, r queryrange.Request) (queryra

intervals := splitByTime(lokiRequest, h.interval)

if sp := opentracing.SpanFromContext(ctx); sp != nil {
sp.LogFields(otlog.Int("n_intervals", len(intervals)))

}

if lokiRequest.Direction == logproto.BACKWARD {
for i, j := 0, len(intervals)-1; i < j; i, j = i+1, j-1 {
intervals[i], intervals[j] = intervals[j], intervals[i]
Expand Down