Observability and metrics¶
Observe three different things: application health, the node's actual runtime binding, and control-plane convergence. No single ready label proves all three.
Logs and actual bindings¶
Use ordinary application stdout/stderr and Kubernetes logs. Correlate Pod UID, container ID, RuntimeImage UID/generation/digest, Node UID and profile UID. Operator and worker logs explain approval, source acquisition, fencing and cleanup; application logs explain application behavior.
brewlet.sh/runtime-bindings on a Node is a complete/freshness-marked
observation with nodeUID, profileUID, profileGeneration, observedAt,
complete and bindings. Each row identifies the actual Pod/container and
leased runtime. Check completeness and freshness before using it for diagnosis.
It is not authority to delete roots.
Enable and scrape¶
Set metrics.enabled: true in the same reviewed Helm values used for installation.
The chart creates:
| Service | Listener | Role |
|---|---|---|
brewlet-operator-metrics |
8080 | Rotation, workload restart and profile observations. |
brewlet-node-metrics |
metrics.nodePort (9090 by default) |
Node-local generation, storage, install and binding metrics. |
Both carry Prometheus scrape annotations. Configure your collector to honor them or author reviewed discovery/scrape configuration. The node Service is headless and publishes not-ready addresses; scraping it does not assert readiness. Node workers use the Pod network, so its endpoints are worker Pod IPs rather than node addresses. The current chart does not bundle a ServiceMonitor or Grafana dashboard switch.
For local inspection, run in a dedicated terminal, using the namespace you
installed Brewlet into (brewlet in installation):
kubectl -n brewlet port-forward service/brewlet-operator-metrics 18081:8080
Then fetch http://127.0.0.1:18081/metrics. Restrict endpoint access using
platform network policy; do not expose inventory metrics publicly by default.
Metric catalog¶
| Family | Important labels | Interpretation |
|---|---|---|
brewlet_runtime_image_install_requests_total |
id, outcome |
Installation request outcomes. |
brewlet_runtime_image_install_duration_seconds |
id |
Install/validation histogram, not application startup latency. |
brewlet_runtime_image_generations |
id, state |
Installed generations by state. |
brewlet_shared_storage_bytes |
store |
Logical runtime/layer storage bytes, not guaranteed physical disk savings. |
brewlet_container_runtime_image_info |
namespace, pod, pod_uid, container, container_id, id, inventory_uid, generation, digest |
Actual live container/runtime binding, value 1. |
brewlet_runtime_image_rotation_complete |
id, inventory_uid, generation, digest |
Node-target convergence, not completed workload remediation. |
brewlet_runtime_image_restarts |
id, inventory_uid, state |
Current target restart outcome counts. |
brewlet_runtime_image_restart_info |
id, inventory_uid, generation, namespace, kind, name, workload_uid, state |
Per-workload restart observation. |
brewlet_runtime_workload_generation_pods |
id, inventory_uid, generation, digest, namespace, kind, name, workload_uid |
Pods of a workload last observed running on each runtime generation; history of when workloads changed generation. |
brewlet_node_profile_nodes |
profile, state |
Assigned/effectively ready target observations. |
brewlet_runtime_image_excluded_nodes |
id, inventory_uid, reason |
Rotation exclusions, including fence failures. |
If the operator cannot read fresh inventory, the scrape fails with a
brewlet_control_inventory_collection error instead of reporting zero
inventory. Watch scrape health as well as business metrics.
PromQL starting points¶
sum by (id, outcome) (rate(brewlet_runtime_image_install_requests_total[5m]))
histogram_quantile(0.95,
sum by (le, id) (rate(brewlet_runtime_image_install_duration_seconds_bucket[5m])))
count by (id, inventory_uid, generation, digest) (brewlet_container_runtime_image_info)
List Pods still on an older generation than the approved target. The
RuntimeImage.status.taskObservations field answers the same question without
Prometheus; see Find workloads still on an older generation.
max by (namespace, pod, id, inventory_uid, generation) (
brewlet_container_runtime_image_info{id="python-3.12"}
) unless on (id, inventory_uid, generation) (
brewlet_runtime_image_rotation_complete{id="python-3.12"}
)
sum by (id, state) (brewlet_runtime_image_restarts)
Use these as dashboard panels alongside scrape health, excluded-node reasons, application error rate and native rollout availability. Review aggregation: the same Pod/container binding is a high-cardinality operational identity, not a label to copy into every application metric.
Look up historical runtime bindings¶
Brewlet does not keep a durable history of which generation each container
used. RuntimeImage.status.taskObservations, brewlet k8s runtime status and
the Node brewlet.sh/runtime-bindings annotation describe the present only.
Source-controlled RuntimeImage changes record intended configuration, not
what each container actually ran. To answer "which generation was this
workload using at time T?", query retained samples of
brewlet_container_runtime_image_info.
Run an instant query evaluated at the time of interest (for example with the
Prometheus time API parameter or the dashboard time picker):
brewlet_container_runtime_image_info{namespace="apps", pod="api-7d9c8f6b5-x2kqz"}
The returned labels include the Pod UID, container ID, inventory UID, generation
and digest. Prometheus selects the most recent sample within its lookback
window unless the series is stale. Use timestamp() on the same selector to
inspect the sample's Unix timestamp, and check scrape health before treating
the result as the binding at that exact time.
To list the bindings observed during the 24 hours ending at the query time:
max by (namespace, pod, pod_uid, container, container_id, id, inventory_uid, generation, digest) (
max_over_time(brewlet_container_runtime_image_info{namespace="apps", pod=~"api-.*"}[24h])
)
This lists distinct observed bindings, not their exact start or end times.
To group by immediate controller, evaluate this query at the time of interest.
It joins the binding to kube-state-metrics kube_pod_owner by Pod UID as well
as namespace and Pod name, avoiding a match to a different Pod with a reused
name:
max by (namespace, owner_kind, owner_name, id, inventory_uid, generation, digest) (
brewlet_container_runtime_image_info{namespace="apps"}
* on (namespace, pod, pod_uid) group_left (owner_kind, owner_name)
label_replace(
max by (namespace, pod, uid, owner_kind, owner_name) (
kube_pod_owner{namespace="apps", owner_is_controller="true"}
),
"pod_uid", "$1", "uid", "(.+)"
)
)
The join requires retained samples of both metrics at that time and excludes Pods without a controller owner. Deployment Pods identify their ReplicaSet as the immediate owner, not the Deployment.
Limits:
- Samples are recorded only while
metrics.enabled: trueand your collector successfully scrapes the node metrics Service; earlier samples cannot be recovered by enabling it later. - The historical query horizon is bounded by the time-series store's retention. Use remote-write or long-term storage when audits need more than the local Prometheus retention.
- The metric is sampled. Containers shorter-lived than the scrape interval can
be missed, and failed or missing scrapes leave gaps. Check
upfor the node metrics targets and target discovery over the same window before treating absence as proof. - A Deployment rollout creates new Pod names; filter by name pattern or join on ownership as above.
See instrumentation recipes and failure diagnosis.