keeping track of errors

Hi, Im working on a simulation to check if my site is currently up.

The idea is to periodically check if the responses I get are ok.

To see that, I would need to keep the time of the last n request that went bad in a row.
If n is large enough, then I should do something (probably send an email)

I’ve been working on this for a while now, but I cant seem to find a way to keep track of the number of checks that have failed, neither if those checks have failed one after another (I dont want to make a fuzz if there were 5 bad request not in a row (maybe in aday or two, thats not too bad, but in a window of just a fe minutes, it all it would take to make me warry.

Is there something that could help me implemnt this.

Rgds, Jc

Keep track of the last failure date/time, and failure count. Every time there is a failure, set the last failure date/time, and increment the failure count. If the failure count is over threshold, do your notification action.

On the other hand, if there is a success, clear last failure date/time, and reset failure count to 0.

It’s simplistic, but it should do the trick for simple outage notification. Which begs the question: Why roll your own? Why not just use a service that already exists?

Hi Juan,

What kind of checks are you doing to checks that your site is up ? Checking the status code of the response ?
Because in all honesty, if your checks doesn’t involve much more that a status code check, using Gatling for that purpose is clearly overkill.
Using Dispatch (http://dispatch.databinder.net/Dispatch.html) and JavaMail to send your email, you could properly get what you want with a custom tool under the 100-150 LOC mark.
Do not misunderstand me, I’m happy that you like Gatling and want to use it, but here, it could just be the wrong tool for your needs.

Cheers,

Pierre