paint-brush
Setting Alerts With 2 Additional Linesby@shauryauppal
541 reads
541 reads

Setting Alerts With 2 Additional Lines

by Shaurya UppalSeptember 2nd, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

KnockKnock is an open-source library for getting alerts/notifications. It can be used in training jobs, data engineering pipelines, scheduled pipelines, in fact, any function’s return statement; with just 2 additional lines of code. You can also set up these alerts on your Email, Desktop Notification, SMS, etc. using just 2 lines. You also get information on how much time a particular job run took along with Start Timestamp and End Timestest Timestamp.

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Setting Alerts With 2 Additional Lines
Shaurya Uppal HackerNoon profile picture


1Liner

KnockKnock is an open-source library for getting alerts/notifications. It can be used in training jobs, data engineering pipelines, scheduled pipelines, in fact, any function’s return statement; with just 2 additional lines of code.


I have been using it for quite some time and it has been amazing for me. I share my experience on LinkedIn as well.

Experience with KnockKnock

Why do I prefer 🚪✊?

  1. It helps me share error logs on my office comms channel slack or teams. It is easier for me to track now; instead of going to the cloud and scrolling through 100s of log lines and then finally knowing the error, directly getting logs on Slack is peaceful.
  2. It gives more visibility to the stakeholders. If someone in your team or PM asks you “For how many daily active users do we have on the platform as of today?” you would either go to your query engine or dashboard to get these numbers. Repeated requests like such make this process arduous and tiresome. Rather on each day schedule pipeline run with KnockKnock which metrics with these high-level metrics. Now everyone in the team has the visibility of a number of users to expect.
  3. You also get information on how much time a particular job run took along with Start Timestamp and End Timestamp.

How should I integrate this? (Just 2 lines)

from knockknock import teams_sender
WEBHOOK_URL = 'https://ABC.webhook.office.com/webhookb2/f762bb6b-cd10-4@894099-80c4-775a0cfe27a7/IncomingWebhook/3e3e4802df/45ec8631ef607'
@teams_sender(WEBHOOK_URL, user_mentions=['Shaurya Uppal'])
def func_name():
    return {'distinct user count': 1000, 'loss': 0.9, 'GCP write job': 'Complete'}

Miscellaneous

You can also set up these alerts on your Email, Desktop Notification, SMS, etc. using 🚪✊ in just 2 lines.

Please feel free to share your views and feedback in the comments section below.

Connect, Follow or Endorse me on LinkedIn if you found this read useful. To learn more about me visit: Here

I also run a Newsletter “Data Science and Problem Solving” which is now read by more than 4500+ subscribers. If you are building an AI or a data product or service, you are invited to become a sponsor of one of the future newsletter issues. Feel free to reach out to [email protected] for more details on sponsorships.

Other Recommended reads:

[1] Experimentation when you can’t A/B Test | Beyond A/B Testing — Switchbacks & Synthetic Control Group

[2] Mastering A/B Testing by understanding Pitfalls

[3] Data Science in Ride-Hailing at Ola, Uber, Rapido, etc.

[4] No more Cancellations? at Uber

Subscribe to get Email Notification of every Newsletter being Published: HERE


I am nominated for the HackerNoon 2022 Noonies, Vote for me: https://www.noonies.tech/2022/programming/2022-hackernoon-contributor-of-the-year-data || https://www.noonies.tech/2022/programming/2022-data-science-demon


Connect 1:1 Meeting here: https://topmate.io/shaurya


This article was first published here.