# Uptime

> What an uptime check does, when your app counts as down and as up again, when you are told, and what differs between the engine and Sypnia Cloud.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service). Status: at launch.  
Source: https://docs.sypnia.com/concepts/uptime/

This page is for anyone who wants to be told when their app stops answering. Uptime checks are part of the open-source engine. Sypnia Cloud runs them from more than one place and sends the alert by e-mail.

Everything else in Sypnia is reported by your app. If your app is down, it reports nothing, and silence looks like a quiet day. An uptime check is the answer to that: Sypnia asks your app, from outside, whether it is there.

## What a check does

An **uptime check** is a request the engine makes to an address of yours, on a schedule.

|                | Default                                                                                                    | You can change it to                                                                                                  |
| -------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| The request    | An HTTP `GET` to the address you give, such as `https://yourapp.com/` or `https://yourapp.com/api/health`. | `HEAD`, and up to 10 headers of your own. Headers are stored and shown as you send them, so do not put secrets there. |
| How often      | Every minute.                                                                                              | Every 5 or 15 minutes.                                                                                                |
| Time allowed   | 10 seconds.                                                                                                | Between 1 and 30 seconds.                                                                                             |
| It passes when | The answer arrives in time and its status is between 200 and 399.                                          | One status, a range or a list. And, for a `GET`, a text the answer must contain in its first 256 KB.                  |

A check **fails** when the answer is late, has another status, lacks the text you asked for, or never comes: the name cannot be resolved, the connection is refused, or the certificate is not valid.

For each request Sypnia keeps the time, whether it passed, the status code or the reason it failed, and how long the answer took.

Every check follows up to 3 redirects, never sends cookies, and names itself with the header `User-Agent: Sypnia-Uptime/1.0`, so you can recognise it in your logs. It only calls public addresses: an address inside a private network is refused, unless you allow it on your own engine.

A check belongs to a project, not to an environment. Its requests are not events and do not count towards a plan's events.

> **Note: What to point a check at**
>
> The front page tells you the site is reachable. A small health address that also reads from your database tells you the app works. Keep it cheap: it is called every minute.

## Down, and up again

One failed request is not an outage. Networks hiccup.

- A check is **down** after **two failures in a row**. That moment opens an **outage**.
- A check is **up** again after **one success**. That closes the outage.

An outage runs from the first of the two failures to the first success. Its length is what Sypnia reports as downtime.

Uptime over a period is the share of the check's requests that passed in it. With a check every minute, thirty failed requests in a day are 97.9 % uptime for that day.

Single results are kept for 7 days. After that Sypnia keeps the numbers of each hour, for 400 days: how many requests, how many failed, and how long the answers took.

## When you are told

Going down and coming back each create an alert. Uptime alerts do not wait for anything else in Sypnia. With a check every minute, the alert arrives about two minutes after your app stops answering. The number of failures that makes the alert, two, can be changed in the project's alert rules.

| Alert    | Says                                                                                                                   |
| -------- | ---------------------------------------------------------------------------------------------------------------------- |
| Down     | Which check, since when, and why: the status code, or «no answer within 10 seconds», or the certificate or name error. |
| Up again | Which check, and how long it was down.                                                                                 |

How the alert reaches you is in [Alerts and the daily summary](https://docs.sypnia.com/concepts/alerts-and-daily-summary). A check that is still down creates no further alerts until it comes back. You can pause a check, for example during planned maintenance; a paused check makes no requests and creates no alerts.

## Engine and Cloud

|                           | Sypnia engine (open source, self-hosted)                                              | Sypnia Cloud (paid service, with a free tier)                                                  |
| ------------------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| Where the check runs from | From where your engine runs: one place.                                               | From three regions.                                                                            |
| When a check fails        | When the request from that one place fails.                                           | When at least two of the three regions fail. One region with a network problem does not count. |
| How you are told          | The alert is recorded and sent to your webhooks. No e-mail in the default deployment. | By e-mail and inside the app, and to your webhooks.                                            |
| How many checks           | 50 for each project by default. The number is yours to change.                        | Set by the plan.                                                                               |

> **Warning: Self-hosting: a check cannot see its own outage**
>
> An engine that runs next to your app, on the same server or the same provider, can go down together with it and then tells you nothing. Run the engine somewhere else than the app it watches, or accept that limit. From one place, a network problem between the engine and your app also looks like an outage.

## What uptime does not do at launch

A check cannot warn you before a certificate expires, and Sypnia has no public status page for your app. Neither is promised; see what is not in the first version on the [Planned](https://docs.sypnia.com/reference/planned) page.

## Example: the shop at night

The shop has one check on `https://yourapp.com/api/health`.

| Time           | Check                       | State                                                                                                                                               |
| -------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| 03:11          | 200 in 180 ms               | Up                                                                                                                                                  |
| 03:12          | No answer within 10 seconds | Still up. One failure.                                                                                                                              |
| 03:13          | 503                         | **Down.** Two failures in a row. The outage starts at 03:12. An alert goes out: «Your app stopped answering at 03:12: no answer within 10 seconds.» |
| 03:14 to 03:23 | 503                         | Down. No new alert.                                                                                                                                 |
| 03:24          | 200 in 240 ms               | **Up.** An alert goes out: «Your app is answering again. It was down for 12 minutes.»                                                               |

In the morning, the daily summary on Sypnia Cloud says the app was down for 12 minutes during the night, instead of «Your app answered all day».

## Reference

Creating and reading checks: the [API reference](https://docs.sypnia.com/api/uptime). On a self-hosted engine, what must be running for checks to be made is in the [self-hosting overview](https://docs.sypnia.com/self-hosting).
