Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge up #771

Merged
merged 35 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5928057
Remove JSON tabbing from HRM debug messages to prevent them spamming …
stephenhand Sep 26, 2024
bdf81cc
Revert json tabbing removal from lambda logs
stephenhand Sep 26, 2024
7a8cadd
Comment out logs that happen every job sweep
stephenhand Sep 26, 2024
727041f
Log that evaluates resource search ES vs DB
stephenhand Sep 26, 2024
4190f72
Change completed lambda to just log. NPM install
stephenhand Sep 30, 2024
993e01e
Fix tsconfig.build.json
stephenhand Sep 30, 2024
fdda59b
Merge pull request #749 from techmatters/SJH-reduce_log_spam
stephenhand Oct 1, 2024
72bc874
chore: add sort options for empty term and tiebreaker
GPaoloni Sep 25, 2024
248b215
chore: safeguard gainst invalid integers in id query
GPaoloni Sep 25, 2024
b781f80
chore: add safeguard against max int
GPaoloni Sep 26, 2024
c807549
ups
GPaoloni Sep 26, 2024
a030070
refactor: better math
GPaoloni Sep 26, 2024
0ff388b
chore: change sort key to timeOfContact (contacts) and createdAt (cases)
GPaoloni Oct 3, 2024
e07a288
Merge pull request #752 from techmatters/CHI-2965-1.18-rc-merge
GPaoloni Oct 3, 2024
910314c
fix: correct type of transcripts
GPaoloni Oct 4, 2024
5570c6a
refactor: improve transcript types
GPaoloni Oct 4, 2024
0e658c4
nit
GPaoloni Oct 7, 2024
98626df
Merge pull request #757 from techmatters/gian_CHI-2963-1.18-rc-merge
GPaoloni Oct 9, 2024
c997db8
chore: added pg-query-stream to hrm-core
GPaoloni Oct 4, 2024
ce3a636
chore: implement reindex contact as streams
GPaoloni Oct 4, 2024
6958453
debug logs
GPaoloni Oct 4, 2024
ec592d9
debug logs
GPaoloni Oct 4, 2024
98b9dd6
chore: implement reindex cases as streams
GPaoloni Oct 7, 2024
1d6bf49
fix: require orderClause in search SQL
GPaoloni Oct 8, 2024
4e29903
nit: remove logs, add return types
GPaoloni Oct 8, 2024
c7e5543
Merge pull request #758 from techmatters/gian_CHI-2994-1.18-rc-merge
GPaoloni Oct 9, 2024
d0c83fe
chore: implement simple query, refactor content query to use it
GPaoloni Oct 10, 2024
2ae3b51
chore: limit the flags available for simple query
GPaoloni Oct 14, 2024
e9fb9f7
Merge pull request #761 from techmatters/gian_CHI-3004-1.18-rc-merge
GPaoloni Oct 14, 2024
b6956ed
fix: cast term to number before asserting if is int
GPaoloni Oct 15, 2024
7bcd357
Merge pull request #763 from techmatters/gian_CHI-3004-reg-1.18-rc-merge
GPaoloni Oct 15, 2024
a63e058
chore: resources search point to shared ES instance
GPaoloni Sep 12, 2024
33e939b
Merge pull request #764 from techmatters/gian_CHI-2827-2-reg-1.18-rc-…
GPaoloni Oct 17, 2024
5630db6
Merge branch 'v1.18-rc' into v1.18-rc-merge
stephenhand Oct 31, 2024
18b845a
Merge pull request #770 from techmatters/v1.18-rc-merge
stephenhand Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hrm-domain/hrm-core/contact-job/contact-job-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions hrm-domain/hrm-core/contact-job/contact-job-publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const publishScrubTranscriptJob = async (
export const publishDueContactJobs = async (
dueContactJobs: ContactJob[],
): Promise<PromiseSettledResult<PublishedContactJobResult>[]> => {
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 {
Expand Down Expand Up @@ -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;
};
13 changes: 4 additions & 9 deletions lambdas/job-complete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
1 change: 0 additions & 1 deletion lambdas/job-complete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion lambdas/job-complete/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{ "path": "packages/types" },
{ "path": "packages/job-errors" },
{ "path": "packages/ssm-cache" },
{ "path": "packages/sns-client" },
{ "path": "lambdas/job-complete" }
]
}
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/elasticsearch-client/src/createIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/elasticsearch-client/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const search = async <T>({
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);
Expand Down
2 changes: 2 additions & 0 deletions resources-domain/resources-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Loading