diff --git a/packages/apollo-datasource-rest/src/RESTDataSource.ts b/packages/apollo-datasource-rest/src/RESTDataSource.ts index ce737ee7184..7ee4a0e165f 100644 --- a/packages/apollo-datasource-rest/src/RESTDataSource.ts +++ b/packages/apollo-datasource-rest/src/RESTDataSource.ts @@ -201,6 +201,24 @@ export abstract class RESTDataSource extends DataSource { ); } + protected async trace( + label: string, + fn: () => Promise, + ): Promise { + if (process && process.env && process.env.NODE_ENV === 'development') { + // We're not using console.time because that isn't supported on Cloudflare + const startTime = Date.now(); + try { + return await fn(); + } finally { + const duration = Date.now() - startTime; + console.log(`${label} (${duration}ms)`); + } + } else { + return fn(); + } + } + private async fetch( init: RequestInit & { path: string; @@ -277,22 +295,4 @@ export abstract class RESTDataSource extends DataSource { return performRequest(); } } - - private async trace( - label: string, - fn: () => Promise, - ): Promise { - if (process && process.env && process.env.NODE_ENV === 'development') { - // We're not using console.time because that isn't supported on Cloudflare - const startTime = Date.now(); - try { - return await fn(); - } finally { - const duration = Date.now() - startTime; - console.log(`${label} (${duration}ms)`); - } - } else { - return fn(); - } - } }