Previously, we printed similar logs for each VM host, but they were hard to digest. Aggregated utilization by location, architecture, and allocation state is more useful for us. For utilization grouped by architecture, I log the utilization of accepting VM hosts; we don't need to consider draining VM hosts. Example logs ```json { "location_utilization": { "allocation_state": "accepting", "location": "hetzner-fsn1", "arch": "x64", "host_count": 1, "used_cores": 1, "total_cores": 32, "core_utilization": 3.13, "used_hugepages_1g": 2, "total_hugepages_1g": 249, "hugepage_utilization": 0.8 }, "message": "location utilization", "time": "2024-12-10 19:47:31 +0000", "thread": "st10g0vmh0st0vt111zat10nzz" } { "arch_utilization": { "host_count": 1, "used_cores": 1, "total_cores": 32, "used_hugepages_1g": 2, "total_hugepages_1g": 249, "arch": "x64", "core_utilization": 3.13, "hugepage_utilization": 0.8 }, "message": "arch utilization", "time": "2024-12-10 19:47:31 +0000", "thread": "st10g0vmh0st0vt111zat10nzz" } ```
40 lines
1.7 KiB
Ruby
Executable File
40 lines
1.7 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require_relative "../loader"
|
|
|
|
d = Scheduling::Dispatcher.new
|
|
Signal.trap("TERM") { d.shutdown }
|
|
|
|
if Config.heartbeat_url
|
|
puts "Starting heartbeat prog"
|
|
# We always insert the heartbeat using the same UBID ("stheartbeatheartbheartheaz")
|
|
Strand.dataset.insert_conflict.insert(id: "8b958d2d-cad4-5f3a-5634-b8b958d45caf", prog: "Heartbeat", label: "wait")
|
|
end
|
|
|
|
if Config.github_app_id
|
|
# We always insert this strand using the same UBID ("stredelivergith0bfail0reaz")
|
|
Strand.dataset.insert_conflict.insert(id: "c39ae087-6ec4-033a-d440-b7a821061caf", prog: "RedeliverGithubFailures", label: "wait", stack: [{last_check_at: Time.now}].to_json)
|
|
end
|
|
|
|
# We always insert this strand using the same UBID ("stresolvee4block0dnsnamesz")
|
|
Strand.dataset.insert_conflict.insert(id: "c3b200ed-ce22-c33a-0326-06d735551d9f", prog: "ResolveGloballyBlockedDnsnames", label: "wait")
|
|
|
|
# We always insert this strand using the same UBID ("stcheckzvsagezalertszzzzza")
|
|
Strand.dataset.insert_conflict.insert(id: "645cc9ff-7954-1f3a-fa82-ec6b3ffffff5", prog: "CheckUsageAlerts", label: "wait")
|
|
|
|
# We always insert this strand using the same UBID ("stexp1repr0ject1nv1tat10na")
|
|
Strand.dataset.insert_conflict.insert(id: "776c1c3a-d804-9f3a-6683-5d874ad04155", prog: "ExpireProjectInvitations", label: "wait")
|
|
|
|
# We always insert this strand using the same UBID ("st10g0vmh0st0vt111zat10nzz")
|
|
Strand.dataset.insert_conflict.insert(id: "08200dd2-20ce-833a-de82-10fd5a082bff", prog: "LogVmHostUtilizations", label: "wait")
|
|
|
|
clover_freeze
|
|
|
|
loop do
|
|
d.start_cohort
|
|
next if d.wait_cohort > 0
|
|
duration_slept = sleep 1
|
|
Clog.emit("respirate finished sleep") { {sleep_duration_sec: duration_slept} }
|
|
end
|