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

store/proxy: fix label values span race #6795

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
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
17 changes: 8 additions & 9 deletions pkg/store/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
Expand Down Expand Up @@ -540,7 +539,6 @@ func (s *ProxyStore) LabelValues(ctx context.Context, r *storepb.LabelValuesRequ
mtx sync.Mutex
g, gctx = errgroup.WithContext(ctx)
storeDebugMsgs []string
span opentracing.Span
)

// We may arrive here either via the promql engine
Expand All @@ -564,12 +562,6 @@ func (s *ProxyStore) LabelValues(ctx context.Context, r *storepb.LabelValuesRequ
if storeID == "" {
storeID = "Store Gateway"
}
span, gctx = tracing.StartSpan(gctx, "proxy.label_values", tracing.Tags{
"store.id": storeID,
"store.addr": storeAddr,
"store.is_local": isLocalStore,
})
defer span.Finish()

// We might be able to skip the store if its meta information indicates it cannot have series matching our query.
if ok, reason := storeMatches(gctx, st, s.debugLogging, r.Start, r.End); !ok {
Expand All @@ -583,7 +575,14 @@ func (s *ProxyStore) LabelValues(ctx context.Context, r *storepb.LabelValuesRequ
}

g.Go(func() error {
resp, err := st.LabelValues(gctx, &storepb.LabelValuesRequest{
span, spanCtx := tracing.StartSpan(gctx, "proxy.label_values", tracing.Tags{
"store.id": storeID,
"store.addr": storeAddr,
"store.is_local": isLocalStore,
})
defer span.Finish()

resp, err := st.LabelValues(spanCtx, &storepb.LabelValuesRequest{
Label: r.Label,
PartialResponseDisabled: r.PartialResponseDisabled,
Start: r.Start,
Expand Down