Skip to content

[content-service] Additional tracing for prebuild init #13097

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

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions components/content-service/pkg/archive/tar.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func ExtractTarbal(ctx context.Context, src io.Reader, dst string, opts ...TarOp
finished := make(chan bool)
m := make(map[string]Info)

unpackSpan := opentracing.StartSpan("unpackTarbal", opentracing.ChildOf(span.Context()))
go func() {
defer close(finished)
for {
Expand Down Expand Up @@ -124,7 +125,9 @@ func ExtractTarbal(ctx context.Context, src io.Reader, dst string, opts ...TarOp
log.WithField("log", string(msg)).Debug("decompressing tar stream log")

<-finished
tracing.FinishSpan(unpackSpan, &err)

chownSpan := opentracing.StartSpan("chown", opentracing.ChildOf(span.Context()))
// lets create a sorted list of pathes and chown depth first.
paths := make([]string, 0, len(m))
for path := range m {
Expand All @@ -148,6 +151,7 @@ func ExtractTarbal(ctx context.Context, src io.Reader, dst string, opts ...TarOp
log.WithError(err).WithField("uid", uid).WithField("gid", gid).WithField("path", p).Debug("cannot chown")
}
}
tracing.FinishSpan(chownSpan, &err)

log.WithField("duration", time.Since(start).Milliseconds()).Debug("untar complete")
return nil
Expand Down
2 changes: 2 additions & 0 deletions components/content-service/pkg/storage/gcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func (rs *DirectGCPStorage) download(ctx context.Context, destination string, bk
var wg sync.WaitGroup

wg.Add(1)
backupSpan := opentracing.StartSpan("downloadBackup", opentracing.ChildOf(span.Context()))

go func() {
defer wg.Done()
Expand Down Expand Up @@ -224,6 +225,7 @@ func (rs *DirectGCPStorage) download(ctx context.Context, destination string, bk
}()

wg.Wait()
tracing.FinishSpan(backupSpan, &err)

rc, err := os.Open(filepath.Join(backupDir, obj))
if err != nil {
Expand Down