Rename to gpu-turnstile; swap port roles

The proxy now listens on the standard service ports (Ollama :11434,
ComfyUI :8188) and the actual services move one port up (:11435, :8189).
Metric prefix is now gpu_turnstile_.
This commit is contained in:
mram
2026-09-20 18:10:22 +02:00
parent 065c294a96
commit db11da8307
10 changed files with 113 additions and 105 deletions
+21 -21
View File
@@ -1,4 +1,4 @@
// Package metrics provides the Prometheus text exposition for gpulock
// Package metrics provides the Prometheus text exposition for gpu-turnstile
// without any external dependencies.
package metrics
@@ -51,7 +51,7 @@ func trimLabel(label string) string {
return label
}
// Metrics holds all gpulock metric values.
// Metrics holds all gpu-turnstile metric values.
type Metrics struct {
llmWait *histogram
imageWait *histogram
@@ -86,36 +86,36 @@ func (m *Metrics) IncImageJobs() { m.imageJobs.Add(1) }
// Render writes the Prometheus text exposition for the given lock snapshot.
func (m *Metrics) Render(w io.Writer, state string, llmInflight int, imagePending bool) {
fmt.Fprint(w, `# HELP gpulock_state Current GPU state (1 for the active state).
# TYPE gpulock_state gauge
fmt.Fprint(w, `# HELP gpu_turnstile_state Current GPU state (1 for the active state).
# TYPE gpu_turnstile_state gauge
`)
for _, s := range []string{"idle", "llm", "image"} {
v := 0
if s == state {
v = 1
}
fmt.Fprintf(w, "gpulock_state{state=%q} %d\n", s, v)
fmt.Fprintf(w, "gpu_turnstile_state{state=%q} %d\n", s, v)
}
pending := 0
if imagePending {
pending = 1
}
fmt.Fprintf(w, `# HELP gpulock_llm_inflight LLM requests currently in flight.
# TYPE gpulock_llm_inflight gauge
gpulock_llm_inflight %d
# HELP gpulock_image_pending Whether an image job is active or waiting.
# TYPE gpulock_image_pending gauge
gpulock_image_pending %d
# HELP gpulock_image_jobs_total Image jobs accepted by ComfyUI.
# TYPE gpulock_image_jobs_total counter
gpulock_image_jobs_total %d
# HELP gpulock_lock_wait_seconds Time spent waiting to acquire the GPU lock.
# TYPE gpulock_lock_wait_seconds histogram
fmt.Fprintf(w, `# HELP gpu_turnstile_llm_inflight LLM requests currently in flight.
# TYPE gpu_turnstile_llm_inflight gauge
gpu_turnstile_llm_inflight %d
# HELP gpu_turnstile_image_pending Whether an image job is active or waiting.
# TYPE gpu_turnstile_image_pending gauge
gpu_turnstile_image_pending %d
# HELP gpu_turnstile_image_jobs_total Image jobs accepted by ComfyUI.
# TYPE gpu_turnstile_image_jobs_total counter
gpu_turnstile_image_jobs_total %d
# HELP gpu_turnstile_lock_wait_seconds Time spent waiting to acquire the GPU lock.
# TYPE gpu_turnstile_lock_wait_seconds histogram
`, llmInflight, pending, m.imageJobs.Load())
m.llmWait.write(w, "gpulock_lock_wait_seconds", `kind="llm",`)
m.imageWait.write(w, "gpulock_lock_wait_seconds", `kind="image",`)
fmt.Fprint(w, `# HELP gpulock_unload_seconds Time spent unloading Ollama models before an image job.
# TYPE gpulock_unload_seconds histogram
m.llmWait.write(w, "gpu_turnstile_lock_wait_seconds", `kind="llm",`)
m.imageWait.write(w, "gpu_turnstile_lock_wait_seconds", `kind="image",`)
fmt.Fprint(w, `# HELP gpu_turnstile_unload_seconds Time spent unloading Ollama models before an image job.
# TYPE gpu_turnstile_unload_seconds histogram
`)
m.unload.write(w, "gpulock_unload_seconds", "")
m.unload.write(w, "gpu_turnstile_unload_seconds", "")
}