Skip to content

Ping: optional GET health endpoint to stop 405 log spam (Fixes #3) - #4

Open
matthewjhunter wants to merge 1 commit into
mainfrom
issue-3-health-endpoint-ping
Open

Ping: optional GET health endpoint to stop 405 log spam (Fixes #3)#4
matthewjhunter wants to merge 1 commit into
mainfrom
issue-3-health-endpoint-ping

Conversation

@matthewjhunter

Copy link
Copy Markdown
Owner

Fixes #3.

Ping issues a HEAD to the transcription endpoint. Servers that don't route HEAD on /v1/audio/transcriptions -- whisper-server, Lemonade -- log a 405 on every poll. At dicta's 10s default that's ~8,600 [Error] lines a day, which buried the real errors while diagnosing homelab#115.

What changed

Implements the issue's preferred option (1): let the caller configure a health path probed with GET, falling back to current behavior when unset.

  • WithHealthEndpoint(url) added to both openai and whispercpp clients. When set, Ping does a GET to that routed path (e.g. Lemonade's http://host:port/api/v1/health) instead of the HEAD.
  • httpcore.PingGET issues the GET and -- like PingHEAD -- treats any response as reachable, draining a bounded amount of the body for connection reuse. It deliberately does not assert 2xx: readiness/health gating is the consumer's job per the module's hard constraints; this only moves the liveness probe onto a path the server actually routes.
  • Unset is unchanged: Ping still does HEAD on the transcription endpoint, byte-for-byte.

Consumers (dicta) opt in by passing WithHealthEndpoint once they know the backend's health path; no behavior changes for anyone who doesn't.

Tested

TDD. CGO_ENABLED=0 go build ./..., go vet ./..., and gofmt all clean; go test ./... and go test -race green.

  • httpcore: PingGET uses GET; a 404 still counts as reachable; a dial failure errors.
  • openai / whispercpp: with a health endpoint set, Ping hits the health path with GET (not HEAD on the transcription endpoint); without it, Ping still does HEAD.

🤖 Generated with Claude Code

Ping defaults to a HEAD against the transcription endpoint. Servers that
do not route HEAD on /v1/audio/transcriptions (whisper-server, Lemonade)
log a 405 on every poll -- at dicta's 10s default that is ~8,600 error
lines a day, burying real errors in the server log.

Add WithHealthEndpoint to the openai and whispercpp clients: when set,
Ping issues a GET to that routed path (e.g. Lemonade's /api/v1/health)
instead of the HEAD. httpcore gains PingGET, which -- like PingHEAD --
treats any response as reachable rather than asserting readiness, so
health gating stays the consumer's job. Unset keeps the existing
HEAD-on-transcription-endpoint behavior byte-for-byte.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

PingHEAD against the transcription endpoint logs a 405 on every poll

1 participant