Skip to content

refactor(guest-agent): conventional metric names, old ones kept for one release - #1103

Merged
kvinwang merged 1 commit into
nextfrom
refactor/metrics-prefixes
Aug 23, 2026
Merged

refactor(guest-agent): conventional metric names, old ones kept for one release#1103
kvinwang merged 1 commit into
nextfrom
refactor/metrics-prefixes

Conversation

@kvinwang

@kvinwang kvinwang commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Content-wise independent of the gateway PRs and already based on next; GitHub's stack tracking keeps the base pinned to #1102's branch until that merges, after which this retargets to next automatically. The visible diff is the guest-agent commit alone either way.

Problem

The guest agent's /metrics template predates any naming conventions and breaks several at once:

old problems new
system_os_name / _os_version / _kernel_version / _cpu_model (4 gauges) info spread over four metrics dstack_guest_info{os_name=,os_version=,kernel_version=,cpu_model=} 1
system_memory_total, system_swap_total, disk_total_size _total on a gauge — reads as a counter to every Prometheus tool; no unit suffix dstack_guest_memory_total_bytes, dstack_guest_swap_total_bytes, dstack_guest_disk_total_bytes
system_memory_used/free/available, system_swap_used/free, disk_free_size, disk_used_size no prefix, no unit dstack_guest_{memory,swap,disk}_*_bytes
system_uptime no unit dstack_guest_uptime_seconds
system_load_average_1m/5m/15m verbose; node_exporter idiom is load1 dstack_guest_load1/5/15
system_num_cpus no application prefix dstack_guest_cpus
disk_usage_percentage conventions want a 0–1 ratio dstack_guest_disk_used_ratio

system_* / disk_* are also the most collision-prone words available for an exposition scraped next to other exporters.

Compatibility

This endpoint is tenant-facing (public_sysinfo), so the dashboards it feeds are not ours to break. Every old series is still emitted verbatim, its HELP marked (deprecated: use dstack_guest_...), with removal announced for a future release.

The gateway (dstack_gateway_*) and KMS (dstack_kms_*_total) expositions already carry compliant application prefixes and are untouched.

Verification

  • cargo test -p dstack-guest-agent — 76 passed; the template is embedded at build time, so compiling is validating
  • cargo test -p dstack-gateway — 285 passed (untouched, run to confirm)

Copilot AI lite review requested due to automatic review settings August 23, 2026 08:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@kvinwang
kvinwang force-pushed the refactor/metrics-prefixes branch from 36e13f4 to e2e67c8 Compare August 23, 2026 08:56
@kvinwang kvinwang changed the title refactor(metrics): shorter gateway prefix, conventional guest-agent names refactor(guest-agent): conventional metric names, old ones kept for one release Aug 23, 2026
Base automatically changed from feat/gateway-removal-refusal-metrics to next August 23, 2026 13:30
…ne release

The `/metrics` template predates any conventions and broke several at
once -- no application prefix on `system_*`/`disk_*` (the most
collision-prone words available), a `_total` suffix on gauges
(`system_memory_total`, `disk_total_size`), which every Prometheus
tool reads as a counter, missing `_bytes`/`_seconds` unit suffixes,
four separate info gauges where one `_info` metric with labels is the
idiom, and a percentage where conventions want a 0-1 ratio.

The new `dstack_guest_*` series fix all of that. The old names keep
being emitted verbatim, marked deprecated in their HELP text: this
endpoint is tenant-facing (`public_sysinfo`), so the dashboards it
feeds are not ours to break -- they get one release cycle to move.

The gateway (`dstack_gateway_*`) and KMS (`dstack_kms_*_total`)
expositions already carry compliant prefixes and are untouched.
@kvinwang
kvinwang force-pushed the refactor/metrics-prefixes branch from e2e67c8 to ddb77b0 Compare August 23, 2026 13:30
@kvinwang
kvinwang merged commit 7a0f03f into next Aug 23, 2026
15 checks passed
@kvinwang
kvinwang deleted the refactor/metrics-prefixes branch August 23, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants