@@ -33,6 +33,7 @@ import (
3333 ccli "github.com/docker/cli/cli/command/container"
3434 pathutil "github.com/docker/compose/v2/internal/paths"
3535 "github.com/docker/compose/v2/internal/sync"
36+ "github.com/docker/compose/v2/internal/tracing"
3637 "github.com/docker/compose/v2/pkg/api"
3738 "github.com/docker/compose/v2/pkg/watch"
3839 "github.com/docker/docker/api/types/container"
@@ -522,7 +523,16 @@ func (s *composeService) rebuild(ctx context.Context, project *types.Project, se
522523 options .LogTo .Log (api .WatchLogger , fmt .Sprintf ("Rebuilding service(s) %q after changes were detected..." , services ))
523524 // restrict the build to ONLY this service, not any of its dependencies
524525 options .Build .Services = services
525- imageNameToIdMap , err := s .build (ctx , project , * options .Build , nil )
526+
527+ var (
528+ imageNameToIdMap map [string ]string
529+ err error
530+ )
531+ err = tracing .SpanWrapFunc ("project/build" , tracing .ProjectOptions (ctx , project ),
532+ func (ctx context.Context ) error {
533+ imageNameToIdMap , err = s .build (ctx , project , * options .Build , nil )
534+ return err
535+ })(ctx )
526536 if err != nil {
527537 options .LogTo .Log (api .WatchLogger , fmt .Sprintf ("Build failed. Error: %v" , err ))
528538 return err
0 commit comments