Cruma
DashboardDownload

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
SettingDefaultMeaning
observability.pull.enabledfalseServe the endpoint. Without the block, or with false, no port is opened.
observability.pull.address127.0.0.1:9464Socket 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:

PathAnswer
/metricsPrometheus text exposition
/healthz200 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: false or removing the block closes it and frees the port.
  • Changing address moves 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

MetricTypeLabelsMeaning
cruma_build_infogaugeversionAlways 1; the label carries the agent version.
cruma_tunnel_connectedgaugenone1 while at least one tunnel transport is connected, else 0.
cruma_tunnel_transportsgaugetransport, stateTransports 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_upgaugeprocess_id1 while the configured hosted process is running, else 0.
cruma_hosted_process_restarts_totalcounterprocess_idRestarts since the agent started. The first start is not a restart.
cruma_hosted_process_last_exit_timestamp_secondsgaugeprocess_idUnix timestamp of the process's most recent exit. A process that has never exited has no series.
cruma_tls_certificate_expiry_timestamp_secondsgaugedomain, sourceExpiry 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_totalcounterrule_index, ruleTraffic 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_totalcounternoneTraffic denied by the firewall's default action.
cruma_waf_rule_blocks_totalcounterrule_index, ruleRequests 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).

MetricTypeExtra labelsMeaning
cruma_http_requests_totalcounternoneRequests started.
cruma_http_request_errors_totalcounternoneRequests that ended in an error.
cruma_http_request_bytes_totalcounternoneRequest body bytes received.
cruma_http_response_bytes_totalcounternoneResponse body bytes sent.
cruma_http_active_requestsgaugenoneRequests in flight.
cruma_http_responses_totalcounterstatus_classCompleted 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.

MetricTypeMeaning
cruma_stream_frontend_streams_total, cruma_stream_backend_streams_totalcounterStreams accepted (frontend) or opened (backend).
cruma_stream_frontend_bytes_from_client_total, cruma_stream_backend_bytes_from_client_totalcounterBytes read from clients.
cruma_stream_frontend_bytes_to_client_total, cruma_stream_backend_bytes_to_client_totalcounterBytes written to clients.
cruma_stream_frontend_active_streams, cruma_stream_backend_active_streamsgaugeStreams 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.