metrics: attribute hashrate to build, device, kernel and job outcomes #14

Merged
grenade merged 1 commits from metrics/build-device-job into main 2026-09-03 11:16:26 +00:00
Owner

Miner side of #9. Additive metrics in a lair-owned module (crates/metrics/src/lair.rs); origin's metrics are untouched.

New series

metric labels what it answers
miner_build_info version, commit which build produced these numbers
miner_config_info engine, gpu_batch_size, gpu_devices, cpu_workers, gpu_throttle_ms which flags; same commit with different flags is a different experiment
miner_device_hashes_total device, kernel per-card throughput; a kernel fallback shows as a label change
miner_device_solutions_total device, kernel outcomes, not just throughput
miner_device_lost_total device, kernel a dead card on a two-card host
miner_gpu_batch_seconds device, kernel, phase=gpu|host where each batch's time goes; the bubble #4, #5, #6 attack
miner_jobs_received_total job cadence from the node
miner_stale_hashes_total engine work done after a newer job existed
miner_job_pickup_seconds engine issued to picked up; the cancel latency of a busy worker, grows with batch size
miner_results_submitted_total, miner_results_send_failed_total seals out, seals lost
miner_seal_latency_seconds found to sent
miner_job_idle_seconds_total sent to next job; node-attributable idle
miner_connects_total, miner_connect_failures_total, miner_disconnects_total, miner_connected, miner_disconnected_seconds_total miner slow, or node gone

Per-device handles are resolved once at engine init (DeviceMetrics on GpuContext), so the per-batch path does two histogram observes and a counter add with no label lookups.

Origin-owned code touched (all marked // lair:)

  • engine-gpu: metrics dependency; metrics field on GpuContext; three timestamps and four recording calls in run_single_batch; one call in the device-lost branch.
  • miner-service: found_at on WorkerResult, created_at on MiningJob, pickup observation in worker_loop, stale/submitted/idle/connection recording in quic.rs, config info in run.
  • miner-cli: set_build_info at startup.
  • deploy.yaml validate: miner_build_info must carry the deployed commit.

Validation

  • clippy -D warnings on all targets and features, fmt, workspace tests: clean.
  • Local run against an unreachable node: /metrics shows miner_build_info{commit="f1064345e5ed-dirty",version="4.0.2"} 1 and miner_config_info{cpu_workers="1",engine="cpu",gpu_batch_size="1000000",...} 1 from startup.
  • The bench workflow runs on this PR (engine-gpu changed) and doubles as the regression check for the instrumentation cost; the number to compare is 144.4 MH/s on benjy.
  • Device and job series appear on the hosts after merge; the deploy's validate checks the build-info gauge.

Not in this PR: recording rules, the dashboard row and the nvidia throttle-reason field, which live in lair/quantus and follow once these series exist on the hosts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CBgs2nSi4H2mdh8kD8vMX5

Miner side of #9. Additive metrics in a lair-owned module (`crates/metrics/src/lair.rs`); origin's metrics are untouched. ## New series | metric | labels | what it answers | | --- | --- | --- | | `miner_build_info` | version, commit | which build produced these numbers | | `miner_config_info` | engine, gpu_batch_size, gpu_devices, cpu_workers, gpu_throttle_ms | which flags; same commit with different flags is a different experiment | | `miner_device_hashes_total` | device, kernel | per-card throughput; a kernel fallback shows as a label change | | `miner_device_solutions_total` | device, kernel | outcomes, not just throughput | | `miner_device_lost_total` | device, kernel | a dead card on a two-card host | | `miner_gpu_batch_seconds` | device, kernel, phase=gpu\|host | where each batch's time goes; the bubble #4, #5, #6 attack | | `miner_jobs_received_total` | | job cadence from the node | | `miner_stale_hashes_total` | engine | work done after a newer job existed | | `miner_job_pickup_seconds` | engine | issued to picked up; the cancel latency of a busy worker, grows with batch size | | `miner_results_submitted_total`, `miner_results_send_failed_total` | | seals out, seals lost | | `miner_seal_latency_seconds` | | found to sent | | `miner_job_idle_seconds_total` | | sent to next job; node-attributable idle | | `miner_connects_total`, `miner_connect_failures_total`, `miner_disconnects_total`, `miner_connected`, `miner_disconnected_seconds_total` | | miner slow, or node gone | Per-device handles are resolved once at engine init (`DeviceMetrics` on `GpuContext`), so the per-batch path does two histogram observes and a counter add with no label lookups. ## Origin-owned code touched (all marked `// lair:`) - `engine-gpu`: `metrics` dependency; `metrics` field on `GpuContext`; three timestamps and four recording calls in `run_single_batch`; one call in the device-lost branch. - `miner-service`: `found_at` on `WorkerResult`, `created_at` on `MiningJob`, pickup observation in `worker_loop`, stale/submitted/idle/connection recording in `quic.rs`, config info in `run`. - `miner-cli`: `set_build_info` at startup. - `deploy.yaml` validate: `miner_build_info` must carry the deployed commit. ## Validation - clippy `-D warnings` on all targets and features, fmt, workspace tests: clean. - Local run against an unreachable node: `/metrics` shows `miner_build_info{commit="f1064345e5ed-dirty",version="4.0.2"} 1` and `miner_config_info{cpu_workers="1",engine="cpu",gpu_batch_size="1000000",...} 1` from startup. - The bench workflow runs on this PR (engine-gpu changed) and doubles as the regression check for the instrumentation cost; the number to compare is 144.4 MH/s on benjy. - Device and job series appear on the hosts after merge; the deploy's validate checks the build-info gauge. Not in this PR: recording rules, the dashboard row and the nvidia throttle-reason field, which live in lair/quantus and follow once these series exist on the hosts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01CBgs2nSi4H2mdh8kD8vMX5
grenade added 1 commit 2026-09-03 11:10:06 +00:00
metrics: attribute hashrate to build, device, kernel and job outcomes
All checks were successful
ci / fmt (pull_request) Successful in 20s
bench / build (pull_request) Successful in 1m2s
ci / clippy (pull_request) Successful in 1m37s
ci / doc (pull_request) Successful in 1m58s
bench / measure (pull_request) Successful in 2m55s
ci / test (pull_request) Successful in 6m50s
3ba996dcdf
quantus/miner#9. Additive metrics in a lair-owned module of the metrics
crate; origin's metrics are untouched so the fleet dashboard keeps working
across origin merges.

Identity:
- miner_build_info{version, commit}: the join key for everything below.
- miner_config_info{engine, gpu_batch_size, gpu_devices, cpu_workers,
  gpu_throttle_ms}: two deploys of one commit with different flags are
  different experiments.

Per device (handles resolved once at engine init, no label lookups in the
batch path):
- miner_device_hashes_total{device, kernel}, miner_device_solutions_total,
  miner_device_lost_total.
- miner_gpu_batch_seconds{device, kernel, phase=gpu|host}: submit-to-mapped
  on the device versus everything else in the batch. This is the bubble
  #4, #5 and #6 attack, measured directly.

Jobs and results:
- miner_jobs_received_total, miner_stale_hashes_total{engine},
  miner_job_pickup_seconds{engine} (issued to picked up; the cancel latency
  of a busy worker), miner_results_submitted_total,
  miner_results_send_failed_total, miner_seal_latency_seconds (found to
  sent), miner_job_idle_seconds_total (sent to next job, node-attributable).

Connection: miner_connects_total, miner_connect_failures_total,
miner_disconnects_total, miner_connected, miner_disconnected_seconds_total.

Origin-owned code touched, each block marked lair: engine-gpu gains a
metrics dependency, a DeviceMetrics handle on GpuContext and timing points
in run_single_batch; miner-service gains found_at on WorkerResult,
created_at on MiningJob and the recording calls; miner-cli sets build info
at startup. Deploy validate now asserts miner_build_info carries the
deployed commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBgs2nSi4H2mdh8kD8vMX5

quantus-bench 3ba996dcdf on benjy.hanzalova.internal

worker median MH/s spread windows
0 143.89 0.4% 144.1, 144.1, 143.9, 143.5, 143.6

total median: 143.89 MH/s (batch 1000000, 5 x 30s, engine gpu-wgpu)

  • gpu 0 NVIDIA GeForce RTX 4090: driver 580.173.02, limit 250 W, draw 250 W, sm 1185 MHz, 54 C
  • parity: OK (25/25 jobs found solutions, all verified against CPU)
    --- resume miner ---
    active
## quantus-bench 3ba996dcdfe8227a14f0267f274429d93ad4c4ca on benjy.hanzalova.internal | worker | median MH/s | spread | windows | | --- | --- | --- | --- | | 0 | 143.89 | 0.4% | 144.1, 144.1, 143.9, 143.5, 143.6 | total median: **143.89 MH/s** (batch 1000000, 5 x 30s, engine gpu-wgpu) - gpu 0 NVIDIA GeForce RTX 4090: driver 580.173.02, limit 250 W, draw 250 W, sm 1185 MHz, 54 C - parity: OK (25/25 jobs found solutions, all verified against CPU) --- resume miner --- active
grenade merged commit 1c8174951c into main 2026-09-03 11:16:26 +00:00
grenade deleted branch metrics/build-device-job 2026-09-03 11:16:26 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blackbeard/miner#14