cds-snc / notification-planning-core

Project planning for GC Notify Core Team
0 stars 0 forks source link

Fix the SMS cost reporting in QuickSight #425

Open jimleroyer opened 1 month ago

jimleroyer commented 1 month ago

Describe the bug

The data set for Notifications with SMS pricing is broken as we started to use AWS Pinpoint instead of AWS SES.

Bug Severity

SEV-3 Minor

This is minor as this does not prevent the product from running properly and has no impact on our users, but it has an impact on our ability to make sound financial decisions if we do not track this.

To Reproduce

Get to any QuickSight analysis/dashboard using the Notifications with SMS pricing dataset and dig into its data. The cost reduced a lot since we switched from SES to Pinpoint, as the former is used only for a small subset of notifications and the latter is the main SMS conduct. We are missing this cost and we need to re-enable its tracking.

Expected behavior

The SES and Pinpoint cost should both be reported into QuickSight.

Impact

Describe overall user/system impact to consider when prioritizing this issue.

If applicable

Impact on Notify users: None

Impact on Recipients: None

Impact on Notify team: Inability to get SMS cost for the past 2-3 months.

Screenshots

The reported cost is missing per notifications. Here is a screenshot showing the aggregation of these per months. The sent notifications did not go down but one would think so when looking at this graph:

image.png

Additional context

We need to bring in the Pinpoint cost into QuickSight!

jimleroyer commented 1 month ago

We were able to get the SMS cost via a nightly dump of SMS usage report that was supported by AWS SNS via configuration. Unfortunately, I am not able to find a similar feature for Pinpoint or AWS End User Messaging.

I created an AWS case (Case ID 172721288500621 - Is there a SMS usage report feature, just like in SNS? - GCNotify production account) to ask if such similar feature exist.

If a similar feature does not exist, it seems our best way to get the SMS cost will be to parse the response back from AWS when we send the SMS notifications and look into the reported cost in there, to be saved directly into the database.

jimleroyer commented 1 month ago

Unfortunately, Pinpoint has no similar feature as the one for SES, i.e. a daily SMS usage report dumped into S3. We likely would have to go with listening to Pinpoint event or delivery reception to get the cost and save it into the database. This should be a new card because this will be more than a bug fix.

sastels commented 3 weeks ago

new card Add Pinpoint costing info to notifications table

sastels commented 2 weeks ago

New fields in the prod RDS tables. Now we can add them to the QuickSight Notifications dataset.

jimleroyer commented 1 week ago

There is a PR ready to be merged today. We will test what happens with the db activity in staging.

sastels commented 1 week ago

staging now the same size as prod, next step is to merge terraform PR to staging and monitor behaviour

sastels commented 1 week ago

staging quicksight tf apply started 10:25

sastels commented 1 week ago

TL;DR

More details:

sastels commented 1 week ago

releasing to prod 4:05

sastels commented 1 week ago

Will fix / remake the sms cost QuickSight report

sastels commented 1 week ago

Fixed (my own copy of) Jimmy's "JLR - SMS volume usage" analysis here.

Shall we publish this new version to a dashboard and mark this Done?

P0NDER0SA commented 6 days ago

Jimmy is gonna take a look today!

P0NDER0SA commented 5 days ago

Jimmy can look today because it was busted yesterday!

jimleroyer commented 4 days ago

I renamed the analysis SMS volume usage - SJA copy to SMS volume usage. I moved a widget on the cost pane that should be elsewhere and that might have been some previous experimentation unrelated to SMS cost data.

Everything looks good. ✅