From dbf9c6e55d1b4bf6032a71b487dfd2b757a93d0b Mon Sep 17 00:00:00 2001 From: anabellabuckvar <41971124+anabellabuckvar@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:50:28 -0400 Subject: [PATCH] DOP-4599 logging --- api/controllers/v1/slack.ts | 1 + src/enhanced/utils/job/handle-job.ts | 1 + src/onDemandApp.ts | 1 + src/repositories/baseRepository.ts | 2 ++ src/repositories/jobRepository.ts | 2 +- src/repositories/repoEntitlementsRepository.ts | 2 +- 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/controllers/v1/slack.ts b/api/controllers/v1/slack.ts index 876998d4f..739d92084 100644 --- a/api/controllers/v1/slack.ts +++ b/api/controllers/v1/slack.ts @@ -236,6 +236,7 @@ export const DeployRepo = async (event: any = {}): Promise => { } if (deployable.length > 0) { try { + console.log('deploying repos'); await deployRepo(deployable, consoleLogger, jobRepository, c.get('jobsQueueUrl')); } catch (e) { return prepResponse(401, 'text/plain', `${e} error deploying repos`); diff --git a/src/enhanced/utils/job/handle-job.ts b/src/enhanced/utils/job/handle-job.ts index 02fe423fc..a6a197b26 100644 --- a/src/enhanced/utils/job/handle-job.ts +++ b/src/enhanced/utils/job/handle-job.ts @@ -66,6 +66,7 @@ export async function handleJob(jobId: string, db: mongodb.Db) { try { await jobManager.startSpecificJob(jobId); + console.log('in enhanced app handle job'); } catch (err) { consoleLogger.info('enhancedApp', err); } diff --git a/src/onDemandApp.ts b/src/onDemandApp.ts index 1174fc9fc..fba10bf27 100644 --- a/src/onDemandApp.ts +++ b/src/onDemandApp.ts @@ -72,6 +72,7 @@ async function init(): Promise { ); try { await jobManager.startSpecificJob(c.get('jobId')); + console.log('in onDemandApp'); } catch (err) { consoleLogger.info('onDemandApp', err); } diff --git a/src/repositories/baseRepository.ts b/src/repositories/baseRepository.ts index 86778ead8..da3e0091f 100644 --- a/src/repositories/baseRepository.ts +++ b/src/repositories/baseRepository.ts @@ -28,6 +28,7 @@ export abstract class BaseRepository { protected async insertMany(docs: Array, errorMsg: string): Promise { try { + console.log('inserting many'); const insertManyResult = await this.promiseTimeoutS( this._config.get('MONGO_TIMEOUT_S'), this._collection.insertMany(docs), @@ -36,6 +37,7 @@ export abstract class BaseRepository { if (insertManyResult?.insertedIds) { return insertManyResult.insertedIds; } + console.log('returned null for insertMany??'); return null; } catch (error) { this._logger.error(`${this._repoName}:upsert`, `Failed to insert job (${JSON.stringify(docs)}) error: ${error}`); diff --git a/src/repositories/jobRepository.ts b/src/repositories/jobRepository.ts index 54c1464e4..6c2763dcc 100644 --- a/src/repositories/jobRepository.ts +++ b/src/repositories/jobRepository.ts @@ -71,7 +71,7 @@ export class JobRepository extends BaseRepository { // Insertion/re-enqueueing should be sent to jobs queue and updates for an existing job should be sent to jobUpdates Queue this._logger.info( 'insertBulkJobs', - `Total Jobs Expected : ${jobs.length}, Jobs: ${JSON.stringify(jobIds)}, Total Jobs Sent: ${jobIds.length}` + `Total Jobs Expected : ${jobs.length}, Jobs: ${JSON.stringify(jobIds)}, Total Jobs Sent: ${jobIds.keys().length}` ); await Promise.all( Object.values(jobIds).map(async (jobId: string) => { diff --git a/src/repositories/repoEntitlementsRepository.ts b/src/repositories/repoEntitlementsRepository.ts index c82389ea3..1cd55b78a 100644 --- a/src/repositories/repoEntitlementsRepository.ts +++ b/src/repositories/repoEntitlementsRepository.ts @@ -52,7 +52,6 @@ export class RepoEntitlementsRepository extends BaseRepository { throw new Error('getIsAdmin function must be given at least one argument'); } let query; - console.log('getIsAdmin function called'); if (slackUserId) { query = { slack_user_id: slackUserId }; } else query = { github_username: githubUsername }; @@ -60,6 +59,7 @@ export class RepoEntitlementsRepository extends BaseRepository { query, `Mongo Timeout Error: Timedout while retrieving entitlements for ${slackUserId}` ); + console.log(`getIsAdmin function called, ${entitlementsObject?.admin}`); return entitlementsObject?.admin; }