Metrics for Prometheus
🧪 Private preview
Metrics export is in private preview. Metric names and labels can change before general availability.
🚧 In development: metrics export is not available in a released build yet.
The agent can serve its traffic, tunnel, certificate and rule counters in Prometheus text format, so Prometheus, Grafana Alloy, or any scraper that reads that format can collect them. Nothing is sent anywhere by default: the endpoint is off until you turn it on.
Turn it on
Add an observability block to settings.yaml, which sits next to cruma.yaml in the agent's configuration folder:
observability:
pull:
enabled: true
address: 127.0.0.1:9464
| Setting | Default | Meaning |
|---|---|---|
observability.pull.enabled | false | Serve the endpoint. Without the block, or with false, no port is opened. |
observability.pull.address | 127.0.0.1:9464 | Socket address to listen on, as host:port (IPv6 as [::1]:9464). An invalid address is rejected when the file is read. |
The listener serves two paths:
| Path | Answer |
|---|---|
/metrics | Prometheus text exposition |
/healthz | 200 OK while the listener is up |
The endpoint has no authentication. Keep it on the loopback address, or bind a private interface and restrict who can reach it. Do not expose it to the Internet.
Changing it while the agent runs
The agent applies a saved change to settings.yaml without a restart:
- Enabling the block opens the listener.
- Setting
enabled: falseor removing the block closes it and frees the port. - Changing
addressmoves the listener to the new address and closes the old one. - If the new address cannot be bound (for example, the port is in use), the old listener keeps running and the agent logs a warning. Saving the same value again does not retry; change the value, or restore the old one, to try again.
Scrape it
scrape_configs:
- job_name: cruma
metrics_path: /metrics
static_configs:
- targets: ["127.0.0.1:9464"]
Check it by hand with curl http://127.0.0.1:9464/metrics. If /metrics answers 503, the agent could not start its metrics provider; see the agent's log.
Metric catalog
Counters end in _total in the output. Every value is read when you scrape, so what you see is the current state.
Agent
| Metric | Type | Labels | Meaning |
|---|---|---|---|
cruma_build_info | gauge | version | Always 1; the label carries the agent version. |
cruma_tunnel_connected | gauge | none | 1 while at least one tunnel transport is connected, else 0. |
cruma_tunnel_transports | gauge | transport, state | Transports per kind and state. transport is quic, http2 or tcp; state is disconnected, connecting, awaiting_assignment, connected or reconnecting. Only kinds the agent has are listed. |
cruma_hosted_process_up | gauge | process_id | 1 while the configured hosted process is running, else 0. |
cruma_hosted_process_restarts_total | counter | process_id | Restarts since the agent started. The first start is not a restart. |
cruma_hosted_process_last_exit_timestamp_seconds | gauge | process_id | Unix timestamp of the process's most recent exit. A process that has never exited has no series. |
cruma_tls_certificate_expiry_timestamp_seconds | gauge | domain, source | Expiry of each certificate the agent manages, in Unix seconds. source is acme or self_signed. At most 512 certificates are listed. |
cruma_firewall_rule_blocks_total | counter | rule_index, rule | Traffic denied by each firewall deny rule. rule_index is the rule's position in your config; rule is its note. |
cruma_firewall_default_deny_blocks_total | counter | none | Traffic denied by the firewall's default action. |
cruma_waf_rule_blocks_total | counter | rule_index, rule | Requests blocked by each WAF rule, labelled like firewall rules. |
An expiring certificate is a good alert: cruma_tls_certificate_expiry_timestamp_seconds - time() < 7 * 86400.
HTTP requests
Per configured route, with the labels listener_port, route (the route's name; empty on a raw listener), route_slot (the route's position in the listener, or unmatched for traffic that matched no route) and scheme (http or https).
| Metric | Type | Extra labels | Meaning |
|---|---|---|---|
cruma_http_requests_total | counter | none | Requests started. |
cruma_http_request_errors_total | counter | none | Requests that ended in an error. |
cruma_http_request_bytes_total | counter | none | Request body bytes received. |
cruma_http_response_bytes_total | counter | none | Response body bytes sent. |
cruma_http_active_requests | gauge | none | Requests in flight. |
cruma_http_responses_total | counter | status_class | Completed requests by 1xx, 2xx, 3xx, 4xx, 5xx or unknown. |
TCP and UDP streams
Per configured frontend (cruma_stream_frontend_*, labels listener_port, frontend_kind, route, backend) and per configured backend (cruma_stream_backend_*, label backend). frontend_kind is tcp, tls_passthrough, tls_terminated_tcp or udp_relay.
| Metric | Type | Meaning |
|---|---|---|
cruma_stream_frontend_streams_total, cruma_stream_backend_streams_total | counter | Streams accepted (frontend) or opened (backend). |
cruma_stream_frontend_bytes_from_client_total, cruma_stream_backend_bytes_from_client_total | counter | Bytes read from clients. |
cruma_stream_frontend_bytes_to_client_total, cruma_stream_backend_bytes_to_client_total | counter | Bytes written to clients. |
cruma_stream_frontend_active_streams, cruma_stream_backend_active_streams | gauge | Streams currently open. |
What is never a label
Labels come only from your configuration (ports, route, backend and hosted-process names, rule notes, certificate domains) or from a fixed set of values. Hostnames, paths, client addresses and headers from requests never become labels, so the number of series stays bounded however much traffic you get.
Next: Configuration, Rate limits.