Skip to content
ModuleM5 — Observe
After this session you canSay from its health endpoints which application in a pod is not up, scrape every metrics endpoint of the release into Prometheus, and write the alerts that matter.
TimeFacilitated: 43 min · On your own: 43 min
Before you startM4-S3: the release healthy after the restore. About 1 GB of spare memory for Prometheus.
Go deeperObservability · Observability: the admin port · Runbooks: triage metrics and health

◆ Orientation (1 min) — See it before the users do

Section titled “◆ Orientation (1 min) — See it before the users do”

So far you learned about problems when a command failed or a page did not load. In production you want to know first: a pod that is up but not ready, a queue that keeps growing, a transport quietly falling back. Osos exposes health and metrics on every workload; this session shows where, what they mean, and which ones deserve to wake someone up.

▤ Concept (6 min) — Health, metrics and what to alert on

Section titled “▤ Concept (6 min) — Health, metrics and what to alert on”

Kubernetes asks each pod two questions: are you ready for traffic (readiness), and are you alive at all (liveness). Osos answers them differently by shape:

WorkloadReadinessLivenessWhere
Combined pods (core-rest, core-data)GET /healthz: 200 only when every hosted application is up; the body lists each application’s state. Also the start-up probe (up to 150 seconds).GET /livez: 200 while the process serves, whatever one application’s stateThe admin port, core.adminPort (9900)
Standalone services (identity, storage, and others)GET /api/ready, checking the database, bus and Redis connections the service usesGET /api/liveThe service port, 3000

For a combined pod the difference matters. Readiness is the aggregate: one half-started application takes the whole pod out of its Services, because serving some requests from a pod that is not fully up is worse than serving none. Liveness is the process only, so one sick application never restarts the pod and its healthy neighbours with it. /livez at 200 while /healthz answers 503 is the system working as designed: read the /healthz body to see which application is not up.

All metrics are in Prometheus format. Each workload tells Prometheus where to find them through its pod annotations (prometheus.io/scrape, path, port), so a Prometheus that follows annotations finds them all without configuration:

WorkloadEndpoint
Combined podsThe admin port’s /metrics (process metrics and the in-process transport); each hosted application also serves its own /api/<app>/metrics on its own port
Standalone HTTP servicesTheir metrics path on port 3000 (read it from the annotations)
Workers without an HTTP server (indexing, notification)/metrics on metrics.port, 9100
Directory importers and other batch jobsPushed to a Pushgateway when metrics.pushgatewayUrl is set

If your cluster runs the Prometheus Operator, the chart also renders a ServiceMonitor for the combined pods and switches their annotations off, so they are not scraped twice. Every metric carries a service label naming the application.

The gateway exposes Prometheus metrics too, on its status listener (port 8007); add it as a scrape target alongside the annotated pods. Its plugins’ per-request timings also go to the gateway’s log at the info level. The scheduler has no HTTP health endpoint (its probes are off in the chart): watch it through its metrics and its log instead.

SignalAlert whenWhy
Readiness of any release podNot ready for more than five minutesUsers are, or will be, affected
core_inproc_dispatch_total{outcome="fallback"}Above zeroThe in-process transport hit a fault and quietly retried over the network: invisible to users, so only this alert shows it
osos_queue_depth (indexing, port 9100)Growing for 15 minutes (max by (queue), not sum)A search-index backlog
Dead-letter queue depth in RabbitMQAbove zeroWork that failed every retry is waiting for you (M7)
osos_scheduled_jobs_total{status="failed"}IncreasingScheduled work is failing
http_request_duration_seconds with status_code 5xxError rate above your baselineApplications are failing requests
osos_import_runs_total, osos_import_records_synced_totalNo successful run in two schedulesThe directory import is silently failing (M4-S2)

A metric with a label per space, per reaction or per entity can grow without limit and exhaust Prometheus. The platform caps every metric at metrics.maxSeries (5000) label combinations: beyond that, new combinations collapse into one series whose labels all read __over_limit__, and the service logs Metric cardinality cap reached once. When you see it, do not just raise the cap: drop the noisy labels with metrics.spaceIdLabelEnabled: false or metrics.idLabelsEnabled: false.

⛏ Lab (30 min) — Read the health, scrape the metrics

Section titled “⛏ Lab (30 min) — Read the health, scrape the metrics”

Goal. You have read the health of both shapes, found each kind of metrics endpoint, and scraped the release with a Prometheus running in the lab cluster.

Before you start. The release healthy. Each port-forward runs in its own terminal; stop it with Ctrl+C when the step is done.

Health

  1. Port-forward the admin port of core-rest: kubectl -n northwind port-forward deploy/nw-osos-core-rest 9900:9900.
  2. In another terminal: curl -s localhost:9900/healthz and curl -s localhost:9900/livez. Note which applications /healthz lists, and their states.
  3. Read how Kubernetes uses them: kubectl -n northwind get deploy nw-osos-core-rest -o jsonpath='{.spec.template.spec.containers[0].readinessProbe}', then the same with livenessProbe and startupProbe.

Metrics endpoints

  1. On the same port-forward: curl -s localhost:9900/metrics | grep core_inproc_dispatch_total | head. Is the transport in use? Is any outcome="fallback" series above zero?
  2. Find a standalone service’s endpoint from its annotations: kubectl -n northwind get pod -l app=osos-identity -o jsonpath='{.items[0].metadata.annotations}'.
  3. Port-forward the indexing worker’s metrics port (kubectl -n northwind port-forward deploy/nw-osos-indexing 9100:9100) and run curl -s localhost:9100/metrics | grep osos_queue_depth.

Prometheus

  1. Install a small Prometheus that follows pod annotations:

    Terminal window
    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    helm install prom prometheus-community/prometheus -n monitoring --create-namespace \
    --set alertmanager.enabled=false --set prometheus-pushgateway.enabled=false \
    --set prometheus-node-exporter.enabled=false --set kube-state-metrics.enabled=false
  2. When it is ready, port-forward it: kubectl -n monitoring port-forward svc/prom-prometheus-server 9090:80, and open http://localhost:9090.

  3. In Status › Targets, find the release’s pods. Then run these queries in the query box: up{kubernetes_namespace="northwind"}, core_inproc_dispatch_total and max by (queue) (osos_queue_depth).

    Screenshot pending Prometheus Targets page listing the northwind release's pods under the kubernetes-pods job, each with state UP What to notice: the combined pods appear once each, on the admin port 9900, and the workers on port 9100; nothing was configured per target.

  4. Write two alert expressions in inventory.md, in PromQL: one for the transport fallback and one for a growing indexing backlog.

Check.

  • You recorded /healthz and /livez answers for core-rest, and which probe uses each.
  • You can say whether the in-process transport is in use, and whether any fallback occurred.
  • You found the identity service’s metrics path and port from its annotations.
  • osos_queue_depth appeared on the indexing worker’s port 9100.
  • Prometheus shows the release’s pods as targets, and up is 1 for them.
  • Your two alert expressions are written down.

Pass condition. All six checks hold.

If something goes wrong

What you seeWhat to do
The port-forward fails with “unable to listen”Something already uses that port on your computer; pick another local port, for example 19900:9900.
/healthz answers 503Read its body: it names the application that is not up. Check that pod’s logs for that application.
No core_inproc_dispatch_total lines at allThe transport has not dispatched anything yet; use the portal for a minute and look again. Absence means “not in use”, not “healthy”.
Prometheus pods stay PendingThe lab is short of memory. Scale nothing of the release down; stop other programs, or give Docker more memory.
No release targets in PrometheusCheck the pods carry prometheus.io/scrape: "true"; with no Prometheus Operator in the lab, they should.
Model answer
  • /healthz on core-rest answers 200 with each hosted application (audit, notification-api, reaction, dependency, comments, timeline, workflow, logging, packaging, functions) in the state up; /livez answers 200 with "status": "alive" and the number of applications. The start-up and readiness probes call /healthz; the liveness probe calls /livez.

  • After using the portal, core_inproc_dispatch_total shows series with outcome="ok": the transport is in use. No fallback series should be above zero.

  • Alert expressions, for example:

    sum(increase(core_inproc_dispatch_total{outcome="fallback"}[10m])) > 0
    max by (queue) (deriv(osos_queue_depth[15m])) > 0 and max by (queue) (osos_queue_depth) > 100

    Choose the threshold from your own baseline; 100 waiting jobs is a starting point for a small tenant.

✓ Practice (5 min) — Check your understanding

Section titled “✓ Practice (5 min) — Check your understanding”
PracticeChoose one answer.

core-rest shows 0/1 ready but is never restarted. /livez answers 200. What do you do?

  1. Explanation for A

    ✗ Incorrect

    Not this one: the process is alive; restarting also restarts its healthy applications and may not help. Find out which one is not up first. See Health: ready is not the same as alive.

  2. Explanation for B

    ✓ Correct

    Correct: readiness is the aggregate of every application in the pod, and its body names the one holding it back. See Health: ready is not the same as alive.

  3. Explanation for C

    ✗ Incorrect

    Not this one: liveness is passing; it is readiness that tells you something. See Health: ready is not the same as alive.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

PracticeChoose one answer.

Why alert on core_inproc_dispatch_total{outcome="fallback"} when users see no errors?

  1. Explanation for A

    ✓ Correct

    Correct: without the alert, a real transport problem stays invisible. See What deserves an alert.

  2. Explanation for B

    ✗ Incorrect

    Not this one: the call succeeds over the network; that is exactly why it is invisible. See What deserves an alert.

  3. Explanation for C

    ✗ Incorrect

    Not this one: fallbacks concern direct calls inside a pod, not the bus. See What deserves an alert.

Check your answer

The correct answer is A. Open the explanation under each option to see why.

PracticeChoose one answer.

A dashboard of reaction metrics shows one series whose labels all read __over_limit__. What does it mean, and what do you do?

  1. Explanation for A

    ✗ Incorrect

    Not this one: the collapse happens in the service, before Prometheus. See Keep cardinality bounded.

  2. Explanation for B

    ✗ Incorrect

    Not this one: the service is fine; one metric reached its series cap. See Keep cardinality bounded.

  3. Explanation for C

    ✓ Correct

    Correct: the cap keeps Prometheus safe; the kill-switches remove the cause. See Keep cardinality bounded.

Check your answer

The correct answer is C. Open the explanation under each option to see why.

PracticeChoose one answer.

You run three indexing replicas. Which query shows the real search-index backlog per queue?

  1. Explanation for A

    ✗ Incorrect

    Not this one: every replica reports the same queue, so a sum counts it three times. See What deserves an alert.

  2. Explanation for B

    ✓ Correct

    Correct: each replica samples the same shared queue, so take one value per queue. See What deserves an alert.

  3. Explanation for C

    ✗ Incorrect

    Not this one: that counts series, not waiting jobs. See What deserves an alert.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

↺ Recap (1 min) — Health and metrics you can read

Section titled “↺ Recap (1 min) — Health and metrics you can read”

You can read the health of both shapes and tell readiness from liveness, find every metrics endpoint and scrape it, and name the alerts that matter, with cardinality kept in check.

Next. In M5-S2 you follow one request through the logs of every service it touched, set up error reporting, and learn what the platform keeps, and for how long.