Sometimes we like to keep a close eye on accounts we create for prospects at @Tinybirdco. If they are having problems, we want to know immediately so that we can jump in and help.

Here is a quick Alerts system I've created for myself, using @integromat and @Tinybirdco 👇
Where does the data for the alerts come from?

Well, we use Tinybird to analyse all our traffic, of course, which is great for performance monitoring and troubleshooting.

Our users can use SQL to analyze their own account usage in real-time: performance, latency, concurrency...
Internally, we can analyse similar stats per account:
- requested url
- timestamp
- duration
- HTTP method
- HTTP status code
- internal handler

I can always check through internal dashboards to understand usage. But to be on the ball, alerts are better.
Let's say there are two interesting prospects (we will call them Elon and Tim 😎) that we want to keep an eye on, with these made-up account_ids: X and Y
In our internal Tinybird account, I create a SQL pipe that returns whether each of those accounts have registered:
- any requests through the API,
- any ingestions or errors, and,
- any usage of the UI over the last 15 minutes.

It looks something like this:
6) Since I'll be wanting to use the same Pipe for multiple accounts, I'm going to turn that list into a parameter.

That way I'll be able to pass dynamically later the list of accounts that I want to track.
Now I expose this Pipe as an API endpoint, so that I can start consuming it via HTTPS from any application
In integromat, I create a new scenario and add an HTTP module to query my API endpoint. I pass in the token as a parameter, as well as the 'account_ids' that I want to track:
I only want to receive one email with stats about all the active accounts I'm tracking, so I need to use 3 modules in Integromat:
- an iterator (to iterate through the data returned),
- string composer (to compose a string per account stats)
- a text aggregator (to join them)
Next, I connect the results to a GMAIL module that will send me the email.
Here is how the email looks if there is activity in one of the accounts. You can customise the contents with HTML or plain text in the "Compose a String" module
Next, I schedule the scenario to run every 15 minutes (the SQL for the API endpoint returns data for the last 15 minutes as well)

Since I only want to get emails IF there is activity, I add a filter after the HTTP module.
And that's it! One easy improvement would be to pick up the Account Ids from a Google Spreadsheet or similar: that way I can simply add/remove accounts that I want to keep an eye on.
You can obviously do this with a simple script and a cron job or similar, but for lazy bastards like me, this works.

It helps me keep an eye on certain accounts and react quickly, so that we can provide customer support and help our customers succeed. 🚀
Some of our customers use their own Tinybird account & stats to track things like:
- ingestion errors/long-running ingestion jobs
- significant changes in latency of requests to endpoints (after a change or during events)
- unexpected changes in their own data (sales, visits..)
The End! Hope that made sense.

Ping me if you want to chat or a Tinybird account to build your own real-time alerts based on your data. ✌️
You can follow @jorgesancha.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.