Skip to content

Commit

Permalink
Update awssqs.go with logging before calling AWS getQueueUrl() & send…
Browse files Browse the repository at this point in the history
…Message().

Added more logging to see what input we are calling AWS methods with.
  • Loading branch information
viv-ng authored Nov 25, 2024
1 parent 2fef5c9 commit 3aa8d27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/services/awssqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Check failure on line 195 in pkg/services/awssqs.go

View workflow job for this annotation

GitHub Actions / Lint Go code

printf: github.com/sirupsen/logrus.Info call has possible Printf formatting directive %s (govet)

Check failure on line 195 in pkg/services/awssqs.go

View workflow job for this annotation

GitHub Actions / test

github.com/sirupsen/logrus.Info call has possible Printf formatting directive %s
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)

Check failure on line 200 in pkg/services/awssqs.go

View workflow job for this annotation

GitHub Actions / Lint Go code

printf: github.com/sirupsen/logrus.Info call has possible Printf formatting directive %s (govet)

Check failure on line 200 in pkg/services/awssqs.go

View workflow job for this annotation

GitHub Actions / test

github.com/sirupsen/logrus.Info call has possible Printf formatting directive %s
return api.SendMessage(c, input)
}

0 comments on commit 3aa8d27

Please sign in to comment.