diff --git a/hrm-domain/hrm-core/contact-job/contact-job-processor.ts b/hrm-domain/hrm-core/contact-job/contact-job-processor.ts index dc354c3f0..65eab1ace 100644 --- a/hrm-domain/hrm-core/contact-job/contact-job-processor.ts +++ b/hrm-domain/hrm-core/contact-job/contact-job-processor.ts @@ -50,14 +50,14 @@ export const JOB_MAX_ATTEMPTS = 20; export function processContactJobs() { if (!processingJobs) { - console.log( + console.info( `Started processing jobs every ${JOB_PROCESSING_INTERVAL_MILLISECONDS} milliseconds.`, ); processingJobs = true; return setInterval(async () => { try { - console.debug(`processContactJobs sweep started.`); + // console.debug(`processContactJobs sweep started.`); await pollAndProcessCompletedContactJobs(JOB_MAX_ATTEMPTS); const now = new Date(); let dueContactJobs: ContactJob[] = []; @@ -80,7 +80,7 @@ export function processContactJobs() { } }); await publishDueContactJobs(dueContactJobs); - console.debug(`processContactJobs sweep complete.`); + // console.debug(`processContactJobs sweep complete.`); } catch (err) { console.error( new ContactJobPollerError( diff --git a/hrm-domain/hrm-core/contact-job/contact-job-publish.ts b/hrm-domain/hrm-core/contact-job/contact-job-publish.ts index 8161f81c4..c02e3e079 100644 --- a/hrm-domain/hrm-core/contact-job/contact-job-publish.ts +++ b/hrm-domain/hrm-core/contact-job/contact-job-publish.ts @@ -91,7 +91,7 @@ export const publishScrubTranscriptJob = async ( export const publishDueContactJobs = async ( dueContactJobs: ContactJob[], ): Promise[]> => { - console.debug(`Processing ${dueContactJobs?.length} due contact jobs.`); + // console.debug(`Processing ${dueContactJobs?.length} due contact jobs.`); const publishedContactJobResult = await Promise.allSettled( dueContactJobs.map(async (dueJob: ContactJob) => { try { @@ -127,7 +127,7 @@ export const publishDueContactJobs = async ( } }), ); - console.debug(`Processed ${dueContactJobs?.length} due contact jobs.`); + // console.debug(`Processed ${dueContactJobs?.length} due contact jobs.`); return publishedContactJobResult; }; diff --git a/lambdas/job-complete/index.ts b/lambdas/job-complete/index.ts index 1bc112b74..779f5144f 100644 --- a/lambdas/job-complete/index.ts +++ b/lambdas/job-complete/index.ts @@ -15,21 +15,16 @@ */ import { CompletedJobProcessorError } from '@tech-matters/job-errors'; -import { publishSns } from '@tech-matters/sns-client'; // eslint-disable-next-line prettier/prettier import type { SQSBatchResponse, SQSEvent, SQSRecord } from 'aws-lambda'; -const processRecord = async (sqsRecord: SQSRecord) => { +const processRecord = async ({ body, messageId, eventSource }: SQSRecord) => { try { - const res = await publishSns({ - message: sqsRecord.body, - topicArn: process.env.SNS_TOPIC_ARN || '', - }); - - console.log(res); + console.log('Completed processing message:', messageId, eventSource); + console.debug(`Message body:`, body); } catch (err) { - console.error(new CompletedJobProcessorError('Failed to process record'), err); + console.error(new CompletedJobProcessorError('Failed to log completed record'), err); } }; diff --git a/lambdas/job-complete/package.json b/lambdas/job-complete/package.json index 9761b6ad8..132fdd4b4 100644 --- a/lambdas/job-complete/package.json +++ b/lambdas/job-complete/package.json @@ -8,7 +8,6 @@ "dependencies": { "@tech-matters/job-errors": "^1.0.0", "@tech-matters/ssm-cache": "^1.0.0", - "@tech-matters/sns-client": "^1.0.0", "@tech-matters/types": "^1.0.0" }, "devDependencies": { diff --git a/lambdas/job-complete/tsconfig.build.json b/lambdas/job-complete/tsconfig.build.json index 255a9fee9..9f6b6d679 100644 --- a/lambdas/job-complete/tsconfig.build.json +++ b/lambdas/job-complete/tsconfig.build.json @@ -6,7 +6,6 @@ { "path": "packages/types" }, { "path": "packages/job-errors" }, { "path": "packages/ssm-cache" }, - { "path": "packages/sns-client" }, { "path": "lambdas/job-complete" } ] } diff --git a/package-lock.json b/package-lock.json index 3c9c61731..3a93c123e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -423,7 +423,6 @@ "license": "AGPL", "dependencies": { "@tech-matters/job-errors": "^1.0.0", - "@tech-matters/sns-client": "^1.0.0", "@tech-matters/ssm-cache": "^1.0.0", "@tech-matters/types": "^1.0.0" }, @@ -25260,7 +25259,6 @@ "version": "file:lambdas/job-complete", "requires": { "@tech-matters/job-errors": "^1.0.0", - "@tech-matters/sns-client": "^1.0.0", "@tech-matters/ssm-cache": "^1.0.0", "@tech-matters/types": "^1.0.0", "@tsconfig/node16": "^1.0.3", diff --git a/packages/elasticsearch-client/src/createIndex.ts b/packages/elasticsearch-client/src/createIndex.ts index 178f01b60..89b72cf2d 100644 --- a/packages/elasticsearch-client/src/createIndex.ts +++ b/packages/elasticsearch-client/src/createIndex.ts @@ -34,7 +34,7 @@ export const createIndex = async ({ } const params = indexConfig.getCreateIndexParams(index); - console.log('Creating index', index, JSON.stringify(params, null, 2)); + console.info('Creating index', index, JSON.stringify(params)); const res = await client.indices.create(params); // This waits for the index to be created and for the shards to be allocated diff --git a/packages/elasticsearch-client/src/search.ts b/packages/elasticsearch-client/src/search.ts index 44e2a5196..c2ec5695b 100644 --- a/packages/elasticsearch-client/src/search.ts +++ b/packages/elasticsearch-client/src/search.ts @@ -77,7 +77,7 @@ export const search = async ({ index, searchParameters, }); - console.debug('search query', JSON.stringify(query, null, 2)); + console.debug('search query', JSON.stringify(query)); const { hits } = await client.search(query); const total = getTotalValue(hits.total); diff --git a/resources-domain/resources-service/package.json b/resources-domain/resources-service/package.json index a814be27b..977d4d0da 100644 --- a/resources-domain/resources-service/package.json +++ b/resources-domain/resources-service/package.json @@ -44,6 +44,8 @@ "es:delete-index:development": "cross-env NODE_ENV=development tsx ./scripts/elasticsearch/delete-index.ts", "es:create-index:staging": "cross-env NODE_ENV=staging tsx ./scripts/elasticsearch/create-index.ts", "es:delete-index:staging": "cross-env NODE_ENV=staging tsx ./scripts/elasticsearch/delete-index.ts", + "es:create-index:production": "cross-env NODE_ENV=production tsx ./scripts/elasticsearch/create-index.ts", + "es:delete-index:production": "cross-env NODE_ENV=production tsx ./scripts/elasticsearch/delete-index.ts", "es:create-index:local": "cross-env AWS_REGION=us-east-1 SSM_ENDPOINT=http://localhost:4566 NODE_ENV=local ELASTICSEARCH_CONFIG_node=http://localhost:9200 tsx ./scripts/elasticsearch/create-index.ts", "es:delete-index:local": "cross-env AWS_REGION=us-east-1 SSM_ENDPOINT=http://localhost:4566 NODE_ENV=local ELASTICSEARCH_CONFIG_node=http://localhost:9200 tsx ./scripts/elasticsearch/delete-index.ts", "build-scripts": "tsc --project tsconfig.scripts.json", diff --git a/resources-domain/resources-service/src/resource/resourceService.ts b/resources-domain/resources-service/src/resource/resourceService.ts index a3d6f2c40..7b5f9c193 100644 --- a/resources-domain/resources-service/src/resource/resourceService.ts +++ b/resources-domain/resources-service/src/resource/resourceService.ts @@ -174,6 +174,11 @@ export const resourceService = () => { ({ id, name }) => resourceMap[id] ?? { id, name, _status: 'missing' }, ); + // Monitors & dashboards use this log statement, review them before updating to ensure they remain aligned. + console.info( + `[resource-search] AccountSid: ${accountSid} - Search Complete. Total count from ES: ${total}, Paginated count from ES: ${items.length}, Paginated count from DB: ${unsortedResourceList.length}.`, + ); + return { results: orderedResults.map(record => isMissingResource(record) ? record : resourceRecordToApiResource(record),