Ping: optional GET health endpoint to stop 405 log spam (Fixes #3) - #4
Open
matthewjhunter wants to merge 1 commit into
Open
Ping: optional GET health endpoint to stop 405 log spam (Fixes #3)#4matthewjhunter wants to merge 1 commit into
matthewjhunter wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3.
Pingissues 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 bothopenaiandwhispercppclients. When set,Pingdoes a GET to that routed path (e.g. Lemonade'shttp://host:port/api/v1/health) instead of the HEAD.httpcore.PingGETissues the GET and -- likePingHEAD-- 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.Pingstill does HEAD on the transcription endpoint, byte-for-byte.Consumers (dicta) opt in by passing
WithHealthEndpointonce they know the backend's health path; no behavior changes for anyone who doesn't.Tested
TDD.
CGO_ENABLED=0 go build ./...,go vet ./..., andgofmtall clean;go test ./...andgo test -racegreen.httpcore:PingGETuses GET; a 404 still counts as reachable; a dial failure errors.openai/whispercpp: with a health endpoint set,Pinghits the health path with GET (not HEAD on the transcription endpoint); without it,Pingstill does HEAD.🤖 Generated with Claude Code