inframarauder / cowin-notifier

A Node.js AWS Lambda function to periodically check cowin for empty vaccination slots and send emails with slot details.
GNU General Public License v3.0
5 stars 0 forks source link

Feature request - Heartbeat #3

Open parthi2929 opened 3 years ago

parthi2929 commented 3 years ago

Currently there is not much of a way if the function is working fine.

Please introduce a heart beat. That is, even if criteria not met, there should be a way of notification to end user if application is working fine.

The first 3 types of issues come to surface, if we have heart beat, event.

  1. Function works, but URL bad response (eg, 403). (ERROR)
  2. Function did not work (some unhandled bug) (ERROR)
  3. Function worked, URL worked, but no availability (INFO)
  4. Function worked, URL worked, and available (SUCCESS).

For every trigger, a common summary format can be sent., which encapsulates all 4 events above.

{
"functionExecutionStatus" : "Success"
"apiStatus" : "Success"
"availabilityStatus" : "Yes"
"availabilityDetails" : { \\your successful result }
}
inframarauder commented 3 years ago

Logs from the function are exported to cloudwatch which can be monitored. You can modify the code to export the logs to a JSON object (like the one you recommended) and have them mailed to you. Make a PR if you do so :)

parthi2929 commented 3 years ago

I could but I am not familiar with these stacks. I am still stuck now with repeated errors after I changed region to ap-south-1 from us-east-2. To start fresh, I deleted S3 bucket, lambda function everything (so they dont remain dormant in us-east-2), and now serverless is raining errors on me.

inframarauder commented 3 years ago

the region must be set to ap-south-1 as that's the only AWS region in India. Any calls made from outside India won't be entertained by the CoWin server.

As for the heartbeat, I'll try to implement it when I get time :)