@@ -1738,8 +1738,9 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
1738
1738
}
1739
1739
1740
1740
public async getSuggestedRepositories ( ctx : TraceContext , organizationId : string ) : Promise < SuggestedRepository [ ] > {
1741
+ traceAPIParams ( ctx , { organizationId } ) ;
1742
+
1741
1743
const user = await this . checkAndBlockUser ( "getSuggestedRepositories" ) ;
1742
- await this . guardWithFeatureFlag ( "includeProjectsOnCreateWorkspace" , user , organizationId ) ;
1743
1744
1744
1745
if ( ! uuidValidate ( organizationId ) ) {
1745
1746
throw new ApplicationError ( ErrorCodes . BAD_REQUEST , "organizationId must be a valid UUID" ) ;
@@ -1752,33 +1753,32 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
1752
1753
lastUse ?: string ;
1753
1754
} ;
1754
1755
1755
- const fetchExampleRepos = async ( ) : Promise < SuggestedRepositoryWithSorting [ ] > => {
1756
- const repos = await this . getFeaturedRepositories ( ctx ) ;
1757
-
1758
- return repos . map ( ( repo ) => ( {
1759
- url : repo . url ,
1760
- priority : 0 ,
1761
- } ) ) ;
1762
- } ;
1763
-
1764
1756
const fetchProjects = async ( ) : Promise < SuggestedRepositoryWithSorting [ ] > => {
1757
+ const span = TraceContext . startSpan ( "getSuggestedRepositories.fetchProjects" , ctx ) ;
1765
1758
const projects = await this . projectsService . getProjects ( user . id , organizationId ) ;
1766
1759
1767
- return projects . map ( ( project ) => ( {
1760
+ const projectRepos = projects . map ( ( project ) => ( {
1768
1761
url : project . cloneUrl . replace ( / \. g i t $ / , "" ) ,
1769
1762
projectId : project . id ,
1770
1763
projectName : project . name ,
1771
1764
priority : 1 ,
1772
1765
} ) ) ;
1766
+
1767
+ span . finish ( ) ;
1768
+
1769
+ return projectRepos ;
1773
1770
} ;
1774
1771
1775
1772
// Load user repositories (from Git hosts directly)
1776
1773
const fetchUserRepos = async ( ) : Promise < SuggestedRepositoryWithSorting [ ] > => {
1774
+ const span = TraceContext . startSpan ( "getSuggestedRepositories.fetchUserRepos" , ctx ) ;
1777
1775
const authProviders = await this . getAuthProviders ( ctx ) ;
1778
1776
1779
1777
const providerRepos = await Promise . all (
1780
1778
authProviders . map ( async ( p ) : Promise < SuggestedRepositoryWithSorting [ ] > => {
1781
1779
try {
1780
+ span . setTag ( "host" , p . host ) ;
1781
+
1782
1782
const hostContext = this . hostContextProvider . get ( p . host ) ;
1783
1783
const services = hostContext ?. services ;
1784
1784
if ( ! services ) {
@@ -1799,10 +1799,14 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
1799
1799
} ) ,
1800
1800
) ;
1801
1801
1802
+ span . finish ( ) ;
1803
+
1802
1804
return providerRepos . flat ( ) ;
1803
1805
} ;
1804
1806
1805
1807
const fetchRecentRepos = async ( ) : Promise < SuggestedRepositoryWithSorting [ ] > => {
1808
+ const span = TraceContext . startSpan ( "getSuggestedRepositories.fetchRecentRepos" , ctx ) ;
1809
+
1806
1810
const workspaces = await this . getWorkspaces ( ctx , { organizationId } ) ;
1807
1811
const recentRepos : SuggestedRepositoryWithSorting [ ] = [ ] ;
1808
1812
@@ -1826,11 +1830,12 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
1826
1830
}
1827
1831
}
1828
1832
1833
+ span . finish ( ) ;
1834
+
1829
1835
return recentRepos ;
1830
1836
} ;
1831
1837
1832
1838
const repoResults = await Promise . allSettled ( [
1833
- fetchExampleRepos ( ) . catch ( ( e ) => log . error ( logCtx , "Could not fetch example repositories" , e ) ) ,
1834
1839
fetchProjects ( ) . catch ( ( e ) => log . error ( logCtx , "Could not fetch projects" , e ) ) ,
1835
1840
fetchUserRepos ( ) . catch ( ( e ) => log . error ( logCtx , "Could not fetch user repositories" , e ) ) ,
1836
1841
fetchRecentRepos ( ) . catch ( ( e ) => log . error ( logCtx , "Could not fetch recent repositories" , e ) ) ,
0 commit comments