CloudJod
Browse the guides

Health

App and server health, drawn: what is wrong now, crashes and errors, incidents, alert rules, attacks refused, and traces of slow requests.

Updated · 34 min read

The Health section says whether your apps and servers are working, drawn rather than listed. Its overview puts what is wrong now at the top, by name and place, and draws every measure beneath it. Its other tabs hold every error, one line for each cause, the incidents that gather what went wrong together, and your alert rules. It is under Health in the sidebar, and each app's own health is a click from its Overview.

A thousand crashes for the same reason are one error that says a thousand times, when it began, in which release, and when it last happened. Each app's Errors tab, beside its logs, lists its own. Its Traces tab says where its requests' time goes: traces of what it was sent, and profiles of the functions it ran.

The overview, drawn

The first tab of Health draws each measure in the form that suits it, over the last day, for every app and server you can see. Every chart has its numbers in a table beneath it, under Show the numbers, so nothing is told by a colour alone.

ChartWhat it shows
Apps, your servers and databases by healthRings of how many are working, need attention, are down, are stopped on purpose, or are not known yet, as health is judged. The whole is written inside, and each part's count and share beside it.
Attacks, by what the firewalls didA ring of the requests your apps' firewalls refused in the last 24 hours: blocked, rate limited, challenged, those an observing firewall would have blocked, and uploads let through without a malware scan.
Requests, hour by hourLines of the requests every app was sent, and of those that failed with a server error (5xx), as the edge counted them.
Answer timesLines of how long the busiest apps took to answer, hour by hour: within how long half of their requests were answered (p50), and nineteen in twenty (p95). An hour with nothing timed is a gap in the line, not an answer in no time.
Errors, hour by hour, by kindColumns of the errors of each hour, coloured by kind, with the apps and servers they happened on ranked beside them, most first. Choosing a column opens the Errors tab at that hour.
Memory used, of what each app reservesA bar for each app: the most its copies used together in a minute of the last ten, against what they reserve. Amber from three quarters full, red from nine tenths, the fullest first.
UptimeA strip for each app with an address: its last 24 hours, an hour a cell, coloured by whether every check was answered, some were not, or none; how it answers now; and the share of checks it answered over 30 days. Up to ten are drawn: those not answering first, then the busiest.

Below them is what changed lately: releases, changes, new errors and outages, the newest first (What changed). A chart whose figures your role may not read is left out, and the rest of the page is drawn.

What is wrong now

When anything is wrong, the overview says so before anything else. Each app, server or database with a problem is named, worst first, with:

An error is wrong now while it is open and happened in the last hour; an older one is still in the Errors tab. When nothing is wrong, the overview says that too, and when it was last checked.

One app's health

An app's Overview says its health in one line, with See its health beside it. Its page in Health shows what is wrong with it now, then its status:

Then its requests and answer times, its errors by kind with the servers and releases they happened in, what its firewall refused, its memory, its uptime, its open errors, each opening its story, and what changed.

Where errors come from

The Errors tab of Health lists what went wrong in every app you can see, and your servers' own problems, one line for each cause, with the filters to narrow it: by status, by how it was found, by app, by server or cluster, and by the words in it.

Found asHowChange to the app
Crash A copy of the app stopped when it should keep running. CloudJod restarts it, and first records why: its exit status, the signal that ended it, whether the kernel stopped it for using more memory than its limit, how much memory it used at most, how long it had run, and the last lines it printed, with the stack trace among them when it printed one. None
Printed in logs A stack trace the app printed and carried on from: a request that failed while the server stayed up. Found in what the app prints, as its logs are stored. None
Sentry SDK An error the app caught and reported with Sentry's SDK for its language, which also sends the request, the user and what happened before it. Add the SDK
Build, task A build, a release command or a scheduled job that failed. These already alert as failed deploys and failed tasks; here they are grouped with the times they failed the same way. None
Server What the agent on one of your own servers saw happen to the machine, and an app it could not start there. See Your own servers. None

Stack traces are read as each language prints them: Go's panics, Python's tracebacks, the stacks Node.js prints, Java, Kotlin and other JVM languages, .NET, Ruby, PHP and Rust. A logger that writes one JSON object a line is read too, when the trace is in one of its fields.

One line per cause

TypeErrorpay() checkout.js TypeErrorpay() checkout.js TypeErrorpay() checkout.js :41:44:52 TypeErrorpay() checkout.js ×3 RangeErrorship() orders.js×1
  1. Errors arrive, each with its stack.
  2. The same cause: the same functions in the same files, in the same order; line numbers are left out, as they move with every edit.
  3. They fold into one line, counted.
  4. An error raised somewhere else in the code is a cause of its own.
Errors raised in the same place in your code are one cause, one line in Health, however many times it happens.

Two errors are the same cause when the app's own code was in the same place: the same functions in the same files, in the same order. Line numbers are left out, because they move every time the file is edited and the bug does not move with them. Your libraries' frames count only when there are no others. An error with no stack is grouped by its type and message, with numbers, ids and addresses taken out of the message; a crash with no stack is grouped by how it ended: out of memory, a signal, or its exit status.

An SDK can choose the grouping itself with Sentry's fingerprint, and Sentry's default placeholder in it stands for CloudJod's own.

Errors at a glance

The top of Health's Errors tab, and of each app's Errors tab, draws how many errors there were over the last day, week or month, a column for each hour or day, coloured by kind: crashes, errors the code reported through its SDK, stack traces in the logs, builds and tasks that failed, and problems with your servers. Every time an error happened is counted, not only the times that are kept. Beside the chart, the apps, servers and releases they happened in are ranked, most first, each a link.

Choose a column, with a click, with the arrow keys and Enter, or in the table of numbers under the chart, and the list below keeps the errors that happened in that hour or day, whatever their status. The page's address says which, so it can be sent to someone. Each error in the list has its last day drawn small beside it. An hour is your own hour; a day is a day in UTC.

An error's own page tells its story, from the time it shows, the latest first:

Your own servers

Each error says where it happened: on CloudJod's servers, which are shared and never told apart, or on one of your own. Health's Errors tab lists them by server and by cluster, and each cluster's page shows its own. A server where many apps fail, or that has problems of its own, is usually the machine rather than the code.

The agent on a server of your own also says what happened to the machine itself:

The first four are the server's own, listed with its name and resolved, ignored or muted by whoever can take it out of service. A server going quiet and a disk filling up are told by the server alerts that already exist, and not again here. Servers attached with an agent older than this release report none of these.

Resolving, ignoring, muting

Everybody who can see an app sees its errors. Whoever can deploy it resolves, ignores, mutes and assigns them, and each change is in the audit log.

Alerts

Settings, Notifications chooses where these go, under Errors:

Each app's Errors tab also draws its server errors and how long it took to answer, hour by hour, as the half and the nineteen in twenty of its requests (p50 and p95).

An app that keeps crashing is also said once, as before, now with the reason it stopped the last time.

Incidents: what went wrong together

One cause is one error, but one outage is often several: a server restarts, two apps on it crash, and their server errors rise. Each new error, error that came back, rise in server errors, alert rule crossing its line and problem of one of your servers joins the open incident about the same app or server, when that had news within the hour, or opens one. An app's error on one of your servers joins that server's incident too, so the machine and what failed on it read as one. A failed build or task is not something going wrong now, and an ignored error says nothing, so neither joins one.

acme/webWorkingNeeds attention
  • Organization
  • Cluster production
  • Server vps-1
  • App web
Incidentabout webOpen
  1. New errorTypeError: cart.total is not a function
  2. 5xx roseServer errors far above their usual rate
  3. Alert rulep95 response time 2,500 ms, above its line of 1,000 ms

NextRelease v43 went out 4 minutes ago: if it is the cause, roll back from Releases.Roll back to v42

An incident as CloudJod gathers it: a new error, the rise in server errors and an alert rule crossing its line, all about one app, with the release that likely caused them first.

Alert rules

New errors and rises in server errors are told about without any setting. A rule is a line of your own: an app slower than you accept, a server's disk nearly full, an app nobody reaches any more. Health, Alert rules lists them and adds one; whoever can change apps sets them.

MeasureOfRead as
Server errorsan app, a server, a cluster, every appthe share of requests answered with a server error (5xx), once 20 requests came in the window
p95 response timean app, a server, a cluster, every appthe milliseconds within which nineteen requests in twenty were answered, once 20 came
Requestsan app, a server, a cluster, every apprequests a minute, on average; the one measure that can have a line it must stay above
Open errorsan app, a server, a cluster, every apphow many errors are open; for a server or a cluster, those that happened there and its servers' own
Processor, memory, diska server, a clusterthe percent used, on average over the window; for a cluster, its busiest server
Log lines with a phrasean apphow many of its log lines held the phrase you give, such as payment failed, in any case, over the window; a line holding it twice counts once

A rule on log lines is counted as CloudJod's servers store the app's logs, so it counts apps that run on them; what your own servers print stays on them. The phrase is plain text, not a pattern: up to 200 characters, matched wherever it appears in a line.

Safe releases watch errors

A guarded or canary release is watched for its health window, and running is not the whole of healthy. A release that brings an error the app had not had, or answers with far more server errors than it did in the hour before, is put back like one that would not start, and says why.

Reporting from a Sentry SDK

Sentry's SDKs are open source and speak a published protocol, and CloudJod receives it. Each app has a key, and CloudJod sets three variables for it:

VariableValue
SENTRY_DSNWhere the SDK sends errors: CloudJod.
SENTRY_RELEASEThe release the app runs, so each error is placed against a release.
SENTRY_ENVIRONMENTproduction, or preview for a pull request's environment.

An app is given its key with its next release, which restarts it anyway, or at once with Give it a key now in its Errors tab. An app that sets SENTRY_DSN itself, to send to Sentry or elsewhere, is left alone. Then add the SDK, and start it:

# Python
import sentry_sdk
sentry_sdk.init()  # reads SENTRY_DSN, SENTRY_RELEASE and SENTRY_ENVIRONMENT

// Node.js
const Sentry = require("@sentry/node");
Sentry.init({ dsn: process.env.SENTRY_DSN });

// Go
sentry.Init(sentry.ClientOptions{}) // reads SENTRY_DSN
defer sentry.Flush(2 * time.Second)

The app's Errors tab has the lines for Ruby, PHP, Java, .NET and the browser too, and its DSN to copy. A DSN is not a secret, since a web page carries it: list the sites a browser may send from, and other sites' pages are turned away. A server's requests are never limited by the list.

What the SDK endpoint keeps, and its limits

Readable JavaScript errors: source maps

Minified JavaScript reports its errors from one long line of code, with its functions named a letter or two. A source map says where each part of a minified file came from. Upload the maps your build makes, and each frame of an error is shown as the code was written: its file, line and function, and the line itself, with where it was in the minified file beneath. Errors are grouped by that code, so the same error from two builds is one error.

Sentry's own tool, sentry-cli, uploads them to CloudJod as it would to Sentry: point it at CloudJod and give it an API key that may deploy the app. Sentry's bundler plugins upload through the same tool; give them the same address, organization, project and key.

export SENTRY_URL=https://api.cloudjod.com
export SENTRY_ORG=your-organization
export SENTRY_PROJECT=your-app
export SENTRY_AUTH_TOKEN=...   # an API key that may deploy the app

# after each build, on the folder it writes
npx @sentry/cli sourcemaps inject ./dist
npx @sentry/cli sourcemaps upload ./dist

inject gives each minified file and its map the same debug ID. Sentry's browser and Node.js SDKs, from 7.47, send it with each error, so a map is found whatever address its file was served from. Deploy the files inject changed: the debug ID the SDK sends is read from them, and their lines are what the map describes.

Without inject, a map is found by the address of the file it maps and the error's release, so upload with --release naming the release your SDK sends. CloudJod sets SENTRY_RELEASE to the release an app runs, which is not known while it is built: for an app CloudJod builds, use inject. A map uploaded without a release serves any release that has none of its own. A file is matched by its path whatever host served it: sentry-cli names dist/assets/index.js ~/assets/index.js, which matches an error from https://example.com/assets/index.js. Give --url-prefix when the app serves its files from another path.

Their limits

cloudjod sourcemaps web
cloudjod sourcemaps delete web 7f6e5d4c-3b2a-4190-8070-605040302010

Cron and heartbeat monitors

A monitor watches a job that should run on a schedule, and tells you when a run is missed (it did not start within its margin of when it was due), fails, or runs too long. An app's monitors are on its Monitors tab, each with its last runs and how long each took.

A job tells its monitor about each run in one of three ways.

# Python, with the Sentry SDK
from sentry_sdk.crons import monitor

@monitor(monitor_slug="nightly-report",
         monitor_config={"schedule": {"type": "crontab", "value": "0 2 * * *"}, "timezone": "Asia/Kathmandu"})
def nightly_report(): ...

// Node.js, with the Sentry SDK
Sentry.withMonitor("nightly-report", runReport, { schedule: { type: "crontab", value: "0 2 * * *" } });

# Any script, over HTTP, with the project and key of the app's DSN
curl "https://api.cloudjod.com/api/PROJECT/cron/nightly-report/KEY/?status=ok"

# Any script, with a monitor's heartbeat address
curl -fsS -m 10 --retry 3 https://api.cloudjod.com/v1/heartbeats/ADDRESS/start
./your-job && curl -fsS -m 10 --retry 3 https://api.cloudjod.com/v1/heartbeats/ADDRESS \
  || curl -fsS -m 10 --retry 3 https://api.cloudjod.com/v1/heartbeats/ADDRESS/fail

A monitor is set with:

SettingWhat it means
ScheduleA five-field crontab, read in its time zone, or every so many minutes, hours, days, weeks, months or years after the last run.
MarginHow many minutes late a run may start and still be the run that was due. Later than that, the run is missed. Five unless you say.
Maximum runtimeHow many minutes a started run may take before it has timed out, up to seven days. Thirty unless you say.
ThresholdsHow many runs in a row must fail before you are told, and how many must end well before you are told the job is back. One each unless you say.

A monitor expects nothing until its first check-in, as at Sentry, so a job is never missed before it has run once. A paused monitor expects nothing and records nothing; resumed, it expects runs again from its next check-in, so the pause is not counted as missed runs. A scheduled command's monitor follows the command: it is paused while the command is turned off, and goes with it.

You are told once when a job starts failing, as A scheduled job is failing, and once when it is back, as A scheduled job is back, through the channels set up for errors. Both join the incident about the app, beside its errors and its address not answering.

Their limits

cloudjod monitors web
cloudjod monitor add web nightly-report --schedule "0 2 * * *" --timezone Asia/Kathmandu
cloudjod monitor set web nightly-report --paused
cloudjod monitor address web nightly-report   # a new heartbeat address; the old one stops working

Traces: where a request's time goes

GET /orders/{id}820 ms weborders-dbstockredis 520 ms http.client GET /stockstock.internal:8080
  1. A request is traced, sent by Sentry's or OpenTelemetry's SDK.
  2. Each span is a piece of its work: a query, a call to another app, when it began and how long it took.
  3. The slowest stands out in the waterfall.
  4. Open a span to see what it was: its operation and the address it used.
One request followed through your app and the apps it calls, each piece of its work a bar: the longest is where the time went.

A trace is one request or job followed through the app, and through the other apps it calls: each span is a piece of its work, a database query or a call to another service, with when it began and how long it took. Traces arrive at the app's key, the one its errors use, two ways.

From Sentry's SDK. The SDK that sends the app's errors sends traces once it is told what share of requests to trace:

# Python
sentry_sdk.init(traces_sample_rate=0.2)  # one request in five

// Node.js
Sentry.init({ dsn: process.env.SENTRY_DSN, tracesSampleRate: 0.2 });

// Go
sentry.Init(sentry.ClientOptions{EnableTracing: true, TracesSampleRate: 0.2})

An error that happens inside a traced request then leads, from its page, to the trace it happened in.

From OpenTelemetry's SDK. Set two variables, the app's project and key taken from its DSN (https://KEY@HOST/PROJECT); the app's Traces tab shows them filled in:

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.cloudjod.com/api/PROJECT/integration/otlp/v1/traces
OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-cloudjod-key=KEY

Spans may be sent as protobuf, the SDKs' default, or as JSON, compressed or not. Sentry's own header, x-sentry-auth: sentry sentry_key=KEY, is accepted too.

What the Traces tab shows

What is counted, and what is kept

Profiles: which functions the time went to

A trace says which query or call was slow; a profile says which of the app's own functions were running. Sentry's SDK records one for a traced request when profiling is turned on in it, sampling what the request's thread is running about a hundred times a second, and sends it with the trace:

# Python: a share of the traced requests is profiled
sentry_sdk.init(traces_sample_rate=0.2, profiles_sample_rate=1.0)

// Node.js, with @sentry/profiling-node
const { nodeProfilingIntegration } = require("@sentry/profiling-node");
Sentry.init({ dsn: process.env.SENTRY_DSN, integrations: [nodeProfilingIntegration()],
  tracesSampleRate: 0.2, profilesSampleRate: 1.0 });

What is kept, and for how long

For coding tools

A tool connected in Develop has list_errors, get_error and update_error: it finds what to fix, reads the stack and the lines before it, and marks the error resolved when its fix is deployed. list_errors also narrows to one server or one cluster, and list_incidents reads what went wrong together.

From the API

curl -H "Authorization: Bearer $CLOUDJOD_TOKEN" \
  "https://api.cloudjod.com/v1/orgs/YOUR-ORG/errors?status=open"