From 3aa8d279f8412fd5a608d5f7316060ea73e005a5 Mon Sep 17 00:00:00 2001 From: viv-ng Date: Mon, 25 Nov 2024 13:09:33 -0800 Subject: [PATCH] Update awssqs.go with logging before calling AWS getQueueUrl() & sendMessage(). Added more logging to see what input we are calling AWS methods with. --- pkg/services/awssqs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/services/awssqs.go b/pkg/services/awssqs.go index 026f9e2e..aa5af81b 100644 --- a/pkg/services/awssqs.go +++ b/pkg/services/awssqs.go @@ -49,12 +49,15 @@ func (s awsSqsService) Send(notif Notification, dest Destination) error { client := sqs.NewFromConfig(cfg) + // 'client' provides credential, region, endpointUrl + // 'getQueueInput()' provides queueName, accountId queueUrl, err := GetQueueURL(context.TODO(), client, s.getQueueInput(dest)) if err != nil { log.Error("Got an error getting the queue URL: ", err) return err } + // 'sendMessageInput()' provides queueUrl, message sendMessage, err := SendMsg(context.TODO(), client, s.sendMessageInput(queueUrl.QueueUrl, notif)) if err != nil { log.Error("Got an error sending the message: ", err) @@ -189,9 +192,11 @@ type SQSSendMessageAPI interface { } var GetQueueURL = func(c context.Context, api SQSSendMessageAPI, input *sqs.GetQueueUrlInput) (*sqs.GetQueueUrlOutput, error) { + log.Info("[GetQueueUrl] queue_name: %s, account_id: %s", input.QueueName, input.QueueOwnerAWSAccountId) return api.GetQueueUrl(c, input) } var SendMsg = func(c context.Context, api SQSSendMessageAPI, input *sqs.SendMessageInput) (*sqs.SendMessageOutput, error) { + log.Info("[SendMsg] queue_url: %s, message_body: %s", input.QueueUrl, input.MessageBody) return api.SendMessage(c, input) }