Skip to content

Commit ba37764

Browse files
log letterEvent and operation
1 parent 32b30a1 commit ba37764

5 files changed

Lines changed: 5 additions & 554 deletions

File tree

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,3 @@ Deployments can be made of any [release](https://github.com/NHSDigital/nhs-notif
138138
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.
139139

140140
Any HTML or Markdown documentation is [© Crown Copyright](https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/) and available under the terms of the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).
141-
142-
to open a PR

infrastructure/terraform/components/api/module_lambda_upsert_letter.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,4 @@ data "aws_iam_policy_document" "upsert_letter_lambda" {
8585
module.sqs_letter_updates.sqs_queue_arn
8686
]
8787
}
88-
89-
statement {
90-
sid = "AllowCloudWatchMetrics"
91-
effect = "Allow"
92-
93-
actions = [
94-
"cloudwatch:PutMetricData"
95-
]
96-
97-
resources = ["*"]
98-
}
99-
10088
}

lambdas/upsert-letter/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"dependencies": {
3-
"@aws-sdk/client-cloudwatch": "^3.972.0",
43
"@aws-sdk/client-dynamodb": "^3.858.0",
54
"@aws-sdk/lib-dynamodb": "^3.858.0",
65
"@internal/datastore": "*",

lambdas/upsert-letter/src/handler/upsert-handler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
162162
);
163163
console.log("The SQSEvent:", event);
164164
const batchItemFailures: SQSBatchItemFailure[] = [];
165-
metrics.setNamespace("vlasis_upsertLetter");
165+
metrics.setNamespace(
166+
process.env.AWS_LAMBDA_FUNCTION_NAME || "upsertletter",
167+
);
166168

167169
const tasks = event.Records.map(async (record) => {
168170
try {
@@ -177,8 +179,9 @@ export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
177179
const type = getType(letterEvent);
178180

179181
const operation = getOperationFromType(type);
182+
console.log("letterEvent: ", letterEvent);
183+
console.log("operation: ", operation);
180184
metrics.putDimensions({
181-
FunctionName: "upsertLambda",
182185
// eslint-disable-next-line sonarjs/pseudo-random
183186
OddOrEven: `${Math.floor(Math.random() * 10) % 2}`,
184187
});
@@ -193,7 +196,6 @@ export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
193196
`Error processing upsert of record ${record.messageId}`,
194197
);
195198
metrics.putDimensions({
196-
FunctionName: "upsertLambda",
197199
// eslint-disable-next-line sonarjs/pseudo-random
198200
OddOrEven: `${Math.floor(Math.random() * 10) % 2}`,
199201
});

0 commit comments

Comments
 (0)