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

solver: fix parent span for preprocess traces #5830

Merged
merged 1 commit into from
Mar 12, 2025
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
13 changes: 9 additions & 4 deletions solver/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ type state struct {
parents map[digest.Digest]struct{}
childVtx map[digest.Digest]struct{}

mpw *progress.MultiWriter
allPw map[progress.Writer]struct{}
mspan *tracing.MultiSpan
mpw *progress.MultiWriter
allPw map[progress.Writer]struct{}
mspan *tracing.MultiSpan
execSpan trace.Span

vtx Vertex
clientVertex client.Vertex
Expand Down Expand Up @@ -902,6 +903,7 @@ func (s *sharedOp) LoadCache(ctx context.Context, rec *CacheRecord) (Result, err
}
// no cache hit. start evaluating the node
span, ctx := tracing.StartSpan(ctx, "load cache: "+s.st.vtx.Name(), trace.WithAttributes(attribute.String("vertex", s.st.vtx.Digest().String())))
s.st.execSpan = span
notifyCompleted := notifyStarted(ctx, &s.st.clientVertex, true)
res, err := s.Cache().Load(withAncestorCacheOpts(ctx, s.st), rec)
tracing.FinishWithError(span, err)
Expand Down Expand Up @@ -938,7 +940,9 @@ func (s *sharedOp) CalcSlowCache(ctx context.Context, index Index, p PreprocessF
return "", errors.Errorf("failed to get state for index %d on %v", index, s.st.vtx.Name())
}
ctx2 := progress.WithProgress(ctx, st.mpw)
if st.mspan.Span != nil {
if st.execSpan != nil {
ctx2 = trace.ContextWithSpan(ctx2, st.execSpan)
} else if st.mspan.Span != nil {
ctx2 = trace.ContextWithSpan(ctx2, st.mspan)
}
err = p(ctx2, res, st)
Expand Down Expand Up @@ -1093,6 +1097,7 @@ func (s *sharedOp) Exec(ctx context.Context, inputs []Result) (outputs []Result,

// no cache hit. start evaluating the node
span, ctx := tracing.StartSpan(ctx, s.st.vtx.Name(), trace.WithAttributes(attribute.String("vertex", s.st.vtx.Digest().String())))
s.st.execSpan = span
notifyCompleted := notifyStarted(ctx, &s.st.clientVertex, false)
defer func() {
tracing.FinishWithError(span, retErr)
Expand Down