Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/content/self-host/workers/health-checks.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Health Checks"
description: "Expose a health endpoint for worker liveness and readiness probes."
---

Health checks verify that a worker is healthy, including its connection to the Rivet control plane.

Mount `registry.routes.health()` in your HTTP router. For example, with Hono: `app.get("/health", () => registry.routes.health())`.

A healthy worker returns `200` with its status, runtime, and version. If its connection to the control plane is unhealthy, it returns `503`. Point your liveness and readiness probes at the mounted path.
10 changes: 10 additions & 0 deletions src/content/self-host/workers/metadata.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Metadata"
description: "Expose RivetKit runtime metadata from a worker."
---

Exposing worker metadata is optional, but useful for verifying the RivetKit version and actor types running on a worker.

Mount `registry.routes.metadata()` in your HTTP router. For example, with Hono: `app.get("/metadata", () => registry.routes.metadata())`.

The endpoint returns the worker's runtime version, registered actor names, and connection metadata as JSON.
5 changes: 5 additions & 0 deletions src/content/self-host/workers/production-checklist.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Split by runtime mode, because the two halves barely overlap. A reader on a serv
- **Ensure log level is not set to debug.** Leave `RIVET_LOG_LEVEL` at its default or explicitly set it to `warn` to avoid excessive logging.
- **Do not set `RIVET_EXPOSE_ERRORS=1` in production.** This exposes internal error details to clients. It is automatically enabled when `NODE_ENV=development`.

## Monitoring

- **Configure health probes.** Mount `registry.routes.health()` and verify your liveness and readiness probes receive `200`. See <SelfHostLink to="workers/health-checks">Health Checks</SelfHostLink>.
- **Scrape Prometheus metrics.** This is recommended for monitoring worker performance and failures. See <SelfHostLink to="workers/prometheus-metrics">Prometheus Metrics</SelfHostLink>.

## Runtime Mode

- **Configure a runner version.** Required for graceful upgrades and draining of old actors. Applies to both serverless and runner modes.
Expand Down
12 changes: 12 additions & 0 deletions src/content/self-host/workers/prometheus-metrics.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Prometheus Metrics"
description: "Expose and scrape process-wide RivetKit metrics from a worker."
---

RivetKit exposes Prometheus metrics that help diagnose actor activity, networking, SQLite behavior, and more.

Mount `registry.routes.prometheusMetrics()` in your HTTP router. For example, with Hono: `app.get("/metrics", (c) => registry.routes.prometheusMetrics(c.req.raw))`.

Configure Prometheus to scrape the mounted path on every worker instance.

By default, this endpoint is exposed without authentication. If your metrics may contain private information, protect it with a token or expose it only on a private router or network.
8 changes: 7 additions & 1 deletion src/sitemap/deployMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ export function platformsFor(
* Non-platform pages in each section. Platform guides are appended after these
* by the sidebar builder and the route.
*/
export const WORKER_PAGES = ["index", "production-checklist"] as const;
export const WORKER_PAGES = [
"index",
"production-checklist",
"health-checks",
"metadata",
"prometheus-metrics",
] as const;

export const CONTROL_PLANE_PAGES = [
"index",
Expand Down
28 changes: 26 additions & 2 deletions src/sitemap/self-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const PAGE_TITLES: Record<string, string> = {
};

/**
* The Self-Host tab's sidebar, derived entirely from `deployMatrix`. All four
* products get the same shape; only the platform lists differ.
* The Self-Host tab's sidebar. All four products get the same shape; only the
* platform lists derived from `deployMatrix` differ.
*/
export function deploySidebar(productId: string): SidebarItem[] {
const base = `/${productId}/self-host`;
Expand Down Expand Up @@ -100,5 +100,29 @@ export function deploySidebar(productId: string): SidebarItem[] {
},
],
},
{
title: "Reference",
pages: [
{
title: "Workers",
icon: faSliders,
collapsible: true,
pages: [
{
title: "Health Checks",
href: `${base}/workers/health-checks/`,
},
{
title: "Metadata",
href: `${base}/workers/metadata/`,
},
{
title: "Prometheus Metrics",
href: `${base}/workers/prometheus-metrics/`,
},
],
},
],
},
];
}
Loading