Client checks in RMON 2.0
Client checks show what happens when people and applications do real work: whether an operation succeeds, what fails, and how its measurements change between releases. A website, Python worker, Java application or mobile app sends observations to RMON 2.0. RMON turns them into reports, comparisons and notifications.
A green availability check is reassuring. It is less reassuring when customers still cannot place an order. Client checks connect monitoring to the result you care about: a submitted order, a generated report, an updated cache or a queue that is actually getting shorter.
This guide starts with the built-in templates, then connects a website, Python code and a Java application. Screenshots use the current RMON interface with demonstration data; the numbers are examples, not benchmarks.
What can you learn from Client checks?
- Are important actions working? Record the outcome of checkout, sign-in, document generation, synchronization or a scheduled task.
- Did a release introduce failures? Compare the same operation by application version, platform, country or a declared context field.
- Where does work accumulate? Measure queue depth, items processed or output size, including work that never makes an HTTP request.
- Are browsers encountering errors? Collect JavaScript error events and compare their source pages and error types.
Your application decides what success means and collects the measurements. RMON receives them; it does not run your business operation. You control which values leave the application and send them to your RMON receiver. No RMON agent is required on each customer device.
Use Client checks alongside scheduled HTTP checks and other agent checks. Real operations reveal failures and regressions that an availability probe may miss. Scheduled probes still matter when nobody is using an application or when it fails before its measurement code can run.
Choose a template for the question you want to answer
A template fills in the check's metrics and context and makes matching measurement code available in Connect. It saves you from defining a common measurement from scratch. Creating the check alone does not instrument an application: you still install or call the generated code.
Scroll horizontally to view the full table.
| Template | What it records | How collection starts | Example question |
|---|---|---|---|
| Page load | Document load duration, timing stages and transferred bytes; no success/failure outcome | Browser code reads navigation timing after the document loads | Are visitors waiting on the server, the connection or the browser? |
| HTTP response | Request duration, status code and success/failure | The example performs a request; browser, .NET and Android examples are available | Can this client reach a particular endpoint? |
| JavaScript errors | One error measurement per captured event, with its error type and source page | Browser code listens for errors and unhandled promise rejections from the point where it is installed | Which page or release is producing client-side errors? |
| Operation duration | Duration and success/failure of an operation you choose | You connect the code to the operation; browser, .NET and Android examples are available | Did checkout, a background task or local processing complete successfully? |
Operation duration is a useful starting point even when reliability matters more than speed: every completed attempt reports an outcome. It does not need to involve a network request. Custom check gives you your own definition when you need values such as queue depth or output size.
The browser HTTP-response collector performs a HEAD request after page load. A blank target uses the site root; cross-origin targets must permit the request through CORS. A successful response means HTTP 2xx, not that a multi-step business process worked. Page-load collection runs once per document; instrument single-page application actions separately with an operation check.
1. Create a project and a check from a template
You need RMON 2.0, permission to edit Client checks and a receiver reachable from your applications. The receiver must support the Client projects role. Follow the RMON Server guide and network requirements if it is not configured yet.
- Open Client checks → New project. Give it a recognizable name, such as
Customer operations. - On Overview, choose New check.
- Select Operation duration under Check template. RMON fills in the name, code, description and definition.
- Before saving, change the name to
Checkout submissionand the code tocheckout.submit. Give it a description that explains the operation. - Expand Metrics and context to inspect the definition: success/failure is enabled, duration is required and measured in milliseconds. Save the check.
Create separate operation checks for report.generate and cache.refresh when following the Python and Java examples below. Keep each code tied to one clear operation, so its distribution and error rate remain meaningful.
You can customize a template's fields. If the resulting definition no longer matches the collector, Connect will use a custom measurement example instead; your integration must supply the extra values. Metric minimum and maximum values validate incoming observations. Set alert thresholds separately: a very slow operation is still useful data.
Use Edit name and description for display changes and New definition version for compatible field additions. Existing clients can keep sending their earlier definition version. Field types, units and whether the check records an outcome cannot change under the same check code.
2. Connect a receiver and sending key
- Open Connect and select the check. Choose the project's Receiver addresses entry and save it.
- Confirm that Event endpoint is the reachable HTTPS address ending in
/api/v1/client/events. - Choose Issue key. Allow the required check codes and environment, such as
production. - For a website, allow its exact origin, for example
https://shop.example.com, with no path or trailing slash. For Python, Java and other native clients, enable Allow applications without an Origin header. Use separate keys for separate integrations. - Copy the issued key while it is visible and paste it into Sending key. Its full value cannot be retrieved after leaving the project or reloading.
- Select Operation duration under Measurement code and the desired example format. Set the environment and platform to match the application.
A sending key submits observations; it cannot read reports or administer RMON. Browser and distributed application code can be inspected, so restrict keys to the needed checks, environments and origins. Disable requests without Origin for a browser-only key. Keep administrative credentials out of client code.
Connect offers Browser JavaScript, Windows / .NET, Android / Java, curl and an HTTP JSON body. There is no separate Python or general-purpose JVM generator. The downloadable examples below use the same HTTP JSON format. Changing a project's receiver updates newly generated examples; update deployed integrations separately.
3. Websites: measure checkout and capture JavaScript errors
Measure an actual user operation
For checkout.submit, copy the complete Browser JavaScript operation collector from Connect into your site before the checkout code runs. It installs window.rmonOperations["checkout.submit"]. Wrap the action at its existing call site:
async function placeOrder(orderPayload) {
return window.rmonOperations["checkout.submit"](async () => {
const response = await fetch("/api/orders", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify(orderPayload)
});
if (!response.ok) throw new Error("Order request failed");
const result = await response.json();
if (result.accepted !== true) throw new Error("Order was not accepted");
return result;
});
}
Here /api/orders is an illustrative endpoint in your own application, with an accepted result field. Adapt those two details to your API and retain its existing authentication and CSRF handling. Call placeOrder from your checkout handler and keep its normal success and error handling.
The wrapper records duration and outcome, preserves the returned result or thrown error, and sends the observation asynchronously. A received HTTP response alone is insufficient: fetch does not reject HTTP error responses, and a business operation can be rejected even with HTTP 200. Define precisely which result counts as success.
The same pattern works for sign-in, uploading a document, opening an editor, decoding an image or saving local work. Wrap the complete promise for the action you want to measure. Installing the collector without calling the wrapper produces no operation observations.
Collect JavaScript errors as a separate check
Create a second check from JavaScript errors, use a sending key that allows this check, then choose its matching browser collector in Connect. Issue a new key if the existing key does not include it. Place the script before the application scripts whose errors you want to observe.
The collector listens to error and unhandledrejection, sends errors = 1 per event and records error_type. It sends at most ten events per document and does not include exception messages, stack traces or rejected values. Compare source pages and error types to locate a problem.
This template records error occurrences, not successful sessions. A quiet page sends no error event. Its observations therefore cannot tell you the percentage of visitors affected, and it has no success/failure outcome for an Error rate (%) rule. Use an operation check when you need a failure percentage with successful attempts in the denominator.
4. Python: observe a background operation
Create report.generate using Operation duration. Allow that code and production in a key that accepts applications without Origin. Copy the event endpoint from Connect and configure RMON_EVENT_ENDPOINT and RMON_SENDING_KEY in the worker's environment.
Download rmon_client.py and place it beside your application code. This example helper uses Python 3.10+ and the standard-library urllib.request; it is not a separate RMON SDK.
from rmon_client import observe_operation
def run_report_job(generate_report, *args, **kwargs):
# Pass your existing report-generation function to this wrapper.
with observe_operation():
result = generate_report(*args, **kwargs)
if result is None:
raise RuntimeError("Report generation produced no result")
return result
Call run_report_job with your existing synchronous report function and its arguments. The example assumes that a successful function returns a non-None result; replace that condition with your application's success criteria, such as a validated output document. Exceptions still propagate to your job runner, while RMON receives status = error and a stable diagnostic code.
The helper measures report.generate, definition version 1, and supplies platform = python, environment = production and app_version = 2.4.0. Set these to your deployed check and release. It records duration with a monotonic timer and sends a fresh event ID and timestamp for each execution.
This works for generating documents, validating a backup, processing an image or rebuilding a local search index. Choose a distinct check code for a distinct operation. An exception caught and suppressed inside your function will look successful unless the integration checks its returned result.
View the complete Python sending helper
"""Example HTTPS sender for RMON Client checks (Python 3.10+)."""
import json
import logging
import os
import random
import re
import time
import uuid
from contextlib import contextmanager
from datetime import datetime, timezone
from http.client import HTTPException
from urllib.error import HTTPError, URLError
from urllib.parse import urlsplit
from urllib.request import HTTPRedirectHandler, Request, build_opener
ENDPOINT = os.environ["RMON_EVENT_ENDPOINT"]
KEY = os.environ["RMON_SENDING_KEY"]
address = urlsplit(ENDPOINT)
if address.scheme != "https" or not address.hostname or address.username:
raise ValueError("RMON_EVENT_ENDPOINT must be an HTTPS receiver URL")
if not re.fullmatch(r"rmon_pub_[A-Za-z0-9_-]{43}", KEY):
raise ValueError("Set RMON_SENDING_KEY to an issued sending key")
log = logging.getLogger("rmon.telemetry")
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
def send_event(event):
"""Return delivery success; retries reuse the exact serialized event."""
body = json.dumps({"schema_version": 1, "project_key": KEY,
"events": [event]}, allow_nan=False).encode("utf-8")
request = Request(ENDPOINT, data=body, method="POST",
headers={"Content-Type": "application/json"})
opener = build_opener(NoRedirect())
reason = "not accepted"
for attempt in range(3):
delay = 2 ** attempt
try:
with opener.open(request, timeout=5) as response:
if response.status in (200, 202):
return True
log.warning("RMON delivery rejected: HTTP %s", response.status)
return False
except HTTPError as error:
code = error.code
retry_after = error.headers.get("Retry-After", "")
error.close()
reason = "HTTP " + str(code)
if code != 429 and not 500 <= code < 600:
break
if re.fullmatch(r"[0-9]{1,8}", retry_after):
delay = min(30, int(retry_after))
except (URLError, OSError, HTTPException) as error:
reason = type(error).__name__
if attempt < 2:
time.sleep(delay + random.uniform(0, 0.5))
log.warning("RMON delivery failed: %s", reason)
return False
@contextmanager
def observe_operation():
"""Measure report.generate; preserve the application's original exception."""
started = time.perf_counter()
success = False
try:
yield
success = True
finally:
event = {
"event_id": str(uuid.uuid4()),
"check": "report.generate",
"definition_version": 1,
"observed_at": datetime.now(timezone.utc).isoformat(timespec="milliseconds"),
"status": "ok" if success else "error",
"duration_ms": (time.perf_counter() - started) * 1000,
"metrics": {},
"context": {"environment": "production", "platform": "python",
"app_version": "2.4.0"},
}
if not success:
event["error"] = {"code": "operation_failed"}
send_event(event)
5. Java: observe a local cache refresh
Create cache.refresh from Operation duration. Configure the same two environment variables with a key scoped to this check, production and requests without Origin. Download RmonClient.java into your source directory.
The helper uses Java 17+ and the standard HttpClient. This example reads a local text snapshot, rejects an empty result and replaces the in-memory snapshot only after reading succeeds. It makes no business HTTP request:
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.concurrent.atomic.AtomicReference;
public final class CacheRefresh {
private static final AtomicReference<String> CACHE =
new AtomicReference<>("");
public static int refresh(Path snapshotPath) throws Exception {
return RmonClient.observe(() -> {
String snapshot = Files.readString(snapshotPath);
if (snapshot.isBlank()) {
throw new IOException("Cache snapshot is empty");
}
CACHE.set(snapshot);
return snapshot.length();
});
}
}
Save this as CacheRefresh.java and call CacheRefresh.refresh(path) from your application's refresh job. A read or validation failure preserves the previous cache and records a failed operation. A successful refresh records success and returns the new snapshot's character count. The count is the application's return value; only duration and outcome are sent by this template.
Adapt the operation to your own cache format and validation. The sending helper uses check cache.refresh, definition version 1, platform java and app version 2.4.0; update those values for your deployment. The same wrapper can measure compression, document signing or local indexing.
View the complete Java sending helper
// Example HTTPS sender for Java 17+. No third-party dependencies.
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ThreadLocalRandom;
public final class RmonClient {
private static final URI ENDPOINT = URI.create(System.getenv("RMON_EVENT_ENDPOINT"));
private static final String KEY = System.getenv("RMON_SENDING_KEY");
private static final System.Logger LOG = System.getLogger("rmon.telemetry");
private static final HttpClient CLIENT = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(3))
.followRedirects(HttpClient.Redirect.NEVER).build();
static {
if (!"https".equals(ENDPOINT.getScheme()) || ENDPOINT.getHost() == null
|| ENDPOINT.getUserInfo() != null) {
throw new IllegalArgumentException("RMON_EVENT_ENDPOINT must use HTTPS");
}
if (KEY == null || !KEY.matches("rmon_pub_[A-Za-z0-9_-]{43}")) {
throw new IllegalArgumentException("Set RMON_SENDING_KEY to an issued key");
}
}
public static <T> T observe(Callable<T> operation) throws Exception {
long started = System.nanoTime();
boolean success = false;
try {
T result = operation.call();
success = true;
return result;
} catch (InterruptedException error) {
Thread.currentThread().interrupt();
throw error;
} finally {
long durationMs = (System.nanoTime() - started) / 1_000_000;
// Variable strings below are fixed literals or validated key/UUID/time values.
String body = """
{"schema_version":1,"project_key":"%s","events":[{
"event_id":"%s","check":"cache.refresh","definition_version":1,
"observed_at":"%s","status":"%s","duration_ms":%d,
"metrics":{},"context":{"environment":"production",
"platform":"java","app_version":"2.4.0"}%s
}]}
""".formatted(KEY, UUID.randomUUID(), Instant.now().truncatedTo(ChronoUnit.MILLIS),
success ? "ok" : "error", durationMs,
success ? "" : ",\"error\":{\"code\":\"operation_failed\"}");
send(body);
}
}
private static void send(String body) {
if (Thread.currentThread().isInterrupted()) {
LOG.log(System.Logger.Level.WARNING, "RMON delivery skipped: interrupted");
return;
}
HttpRequest request = HttpRequest.newBuilder(ENDPOINT)
.timeout(Duration.ofSeconds(5)).header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body)).build();
String reason = "not accepted";
for (int attempt = 0; attempt < 3; attempt++) {
long delayMs = (1L << attempt) * 1000;
try {
var response = CLIENT.send(request, HttpResponse.BodyHandlers.discarding());
int status = response.statusCode();
if (status == 200 || status == 202) return;
reason = "HTTP " + status;
if (status != 429 && (status < 500 || status >= 600)) break;
String retry = response.headers().firstValue("Retry-After").orElse("");
if (retry.matches("[0-9]{1,8}")) {
delayMs = Math.min(30_000, Long.parseLong(retry) * 1000);
}
} catch (IOException error) {
reason = error.getClass().getSimpleName();
} catch (InterruptedException error) {
Thread.currentThread().interrupt();
LOG.log(System.Logger.Level.WARNING, "RMON delivery interrupted");
return;
}
if (attempt < 2) {
try {
Thread.sleep(delayMs + ThreadLocalRandom.current().nextInt(500));
} catch (InterruptedException error) {
Thread.currentThread().interrupt();
LOG.log(System.Logger.Level.WARNING, "RMON delivery interrupted");
return;
}
}
}
LOG.log(System.Logger.Level.WARNING, "RMON delivery failed: {0}", reason);
}
}
For Android, use the generated Android / Java example in Connect instead. It targets Android APIs and is different from a general JVM application. Follow its installation instructions, add the Internet permission and call the operation sender from a worker thread.
Both downloadable helpers keep telemetry delivery failures separate from the business result, log delivery failures without the key or event payload, and make at most three attempts. They retry network failures, HTTP 429 and 5xx responses using the same serialized body and event ID; redirects are not followed. Delivery is synchronous and can wait for timeouts and retry delays. Use them in background work, or pass observations to your application's existing bounded delivery queue for latency-sensitive paths. These examples do not persist pending events across process restarts.
6. Measure something other than time: queue depth
A queue can be growing while every individual job still completes successfully. Create a Custom check with code queue.depth, turn off outcome and duration, and add a required integer metric queued_jobs, unit count, minimum 0. Make it the primary metric. Add a required, filterable context field queue with allowed values emails and reports.
Use a sending key that allows queue.depth, production and requests without Origin. Issue a new key if needed and update the worker's RMON_SENDING_KEY; include report.generate too if the same worker sends both checks. Using send_event from the helper, publish your queue system's actual current count:
import uuid
from datetime import datetime, timezone
from rmon_client import send_event
def publish_queue_depth(queue_name, queued_jobs):
if queue_name not in {"emails", "reports"}:
raise ValueError("Unknown queue")
if type(queued_jobs) is not int or not 0 <= queued_jobs <= 2**53 - 1:
raise ValueError("Queue depth must be a nonnegative safe integer")
return send_event({
"event_id": str(uuid.uuid4()),
"check": "queue.depth",
"definition_version": 1,
"observed_at": datetime.now(timezone.utc).isoformat(timespec="milliseconds"),
"metrics": {"queued_jobs": queued_jobs},
"context": {"environment": "production", "platform": "python",
"queue": queue_name}
})
Call this from your existing periodic job, using a real queue count. Send zero when the queue is empty; silence is not a zero. There is no status or duration_ms because this definition has neither. Compare by queue to separate the workloads.
Use the same approach for output size in bytes, items processed per operation or validation failures. Declare each metric and unit first. Standard context includes environment, platform, app version, country and network type; up to two declared custom context fields can be enabled for filtering and grouping. Avoid customer identifiers, document contents and exception text when a stable category or count is sufficient.
7. Verify observations and compare releases
Send a known successful operation and a deliberate failure, then inspect Recent events. HTTP 202 means accepted; 200 means already received. Open Report after the observation's minute has ended and processing has caught up.
Select checkout.submit, the period and metric. Filter by environment = production, then choose Compare by → App version. Supply your release in the outgoing event's context.app_version to use this comparison; set it in the browser collector's observation context as well.
The demonstration shows more failures and a higher approximate p95 duration in version 2.4.0. That identifies a release and operation to investigate, not the cause. Compare similar workloads and segments before attributing the change to a release.
- Observations counts received observations; it is not a count of unique users.
- Error rate uses observations reporting success or failure. It is useful for the operation checks above.
- Measured values counts observations contributing to the selected metric and outcome filter. Duration reports for checks with outcomes default to successful operations; choose All or Failed to inspect failed attempts.
- Approximate p95 describes the slower end of a distribution. Read it alongside sample count, error rate and the mean.
For queue depth, select Queued jobs and compare queues. For JavaScript errors, compare source pages and error_type; each received error event contributes one error measurement. Reports describe the received sample, and missing values are not zeros. Lines between points do not prove continuous observation. Country is approximate, and page URLs omit query parameters and fragments.
8. Notify on failed operations or growing queues
Create a notification channel in the project's group. Open Notifications, select checkout.submit and choose New rule. For a busy checkout, a starting example is:
- Name:
Checkout failures; environment:production. - Statistic: Error rate (%); condition: >; threshold:
5. - Window: 5 minutes; minimum: 100 measurements per window.
- Require two consecutive windows to open an incident and two healthy windows to resolve it. Wait two minutes for late data.
- Select notification channels below the conditions, then save.
For error rate, the minimum count uses observations with outcomes. Choose windows and sample counts that suit your traffic: a nightly job will not provide 100 observations every five minutes.
For queue.depth, a different rule can watch Maximum → Queued jobs > 500, filtered to queue = emails. Set a minimum count appropriate to your publishing interval. This detects an accumulated backlog without measuring page speed. A duration p95 rule remains useful when you also need to catch slow operations.
Rules evaluate future completed windows after the configured delay. Missing data, insufficient samples and pending processing break consecutive-window counts and do not resolve an incident. Continue sending healthy values, including zero queue depth, to show recovery. Client checks do not automatically turn a missing scheduled job into a failure observation.
Late data can update historical reports without reopening already evaluated windows. Check incident history for delivery failures and retry failed deliveries after fixing the channel. Pausing a rule stops evaluation but does not close an incident or cancel queued messages; an open incident keeps its conditions and recipients until recovery.
If the first observation does not appear
- No event: confirm that the measurement code ran. For Operation duration, call the wrapper around real work. Check receiver reachability, collection state and the sending response.
- Rejected request: verify the key's checks, environment, browser origin or no-Origin permission. Match the check code, definition version, required fields and metric types. Use a current timestamp: observations must be within the past 24 hours and no more than five minutes in the future.
- Event received, empty report: wait for its minute to end and inspect processing status, time range, filters and Metric outcomes.
- Template collector missing: check whether custom fields changed the definition. Use a matching template definition or supply the fields through a custom integration.
- No incident or notification: check completed windows, minimum sample count, filters, consecutive breaches, enabled state and channel delivery status.
Update and recover
Follow the backup and recovery guide and update guide. Preserve the database, configuration, encryption key and certificates. After updating, verify an existing agent check and a new client observation, its report and notifications. Rollback requires the previous application together with its matching pre-upgrade database and configuration.
For the broader idea, read Client checks: monitoring from the user's side.