File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "dependencies" : {
3+ "@aws-sdk/client-cloudwatch" : " ^3.972.0" ,
34 "@aws-sdk/client-dynamodb" : " ^3.858.0" ,
45 "@aws-sdk/lib-dynamodb" : " ^3.858.0" ,
56 "@internal/datastore" : " *" ,
Original file line number Diff line number Diff line change @@ -20,8 +20,14 @@ import {
2020} from "@nhsdigital/nhs-notify-event-schemas-letter-rendering" ;
2121import z from "zod" ;
2222import { Unit , metricScope } from "aws-embedded-metrics" ;
23+ import {
24+ CloudWatchClient ,
25+ PutMetricDataCommand ,
26+ } from "@aws-sdk/client-dynamodb" ;
2327import { Deps } from "../config/deps" ;
2428
29+ const cwClient = new CloudWatchClient ( { region : "eu-west-2" } ) ;
30+
2531type SupplierSpec = { supplierId : string ; specId : string } ;
2632type PreparedEvents = LetterRequestPreparedEventV2 | LetterRequestPreparedEvent ;
2733type UpsertOperation = {
@@ -158,6 +164,7 @@ export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
158164 return async ( event : SQSEvent ) => {
159165 console . log ( "The SQSEvent:" , event ) ;
160166 const batchItemFailures : SQSBatchItemFailure [ ] = [ ] ;
167+ metrics . setNamespace ( "vlasis_upsertLetter" ) ;
161168
162169 const tasks = event . Records . map ( async ( record ) => {
163170 try {
@@ -181,6 +188,7 @@ export default function createUpsertLetterHandler(deps: Deps): SQSHandler {
181188 OperationType : operation . name ,
182189 } ) ;
183190 metrics . setProperty ( "operation" , operation . name ) ;
191+
184192 metrics . putMetric ( "MessagesProcessed" , 1 , Unit . Count ) ;
185193 } catch ( error ) {
186194 deps . logger . error (
You can’t perform that action at this time.
0 commit comments