ref(healthcheck): Share one python3 HTTP healthcheck for sentry web and snuba api - #4539
Merged
Merged
Conversation
…nd snuba api Replace the web healthcheck's bash /dev/tcp probe, which needs a shell, with healthcheck/http.py, a generalized version of snuba/api_healthcheck.py that takes the URL as an argument. The healthcheck/ directory is mounted read-only at /healthcheck, like ./geoip, for sentry services and snuba-api.
oioki
marked this pull request as ready for review
September 30, 2026 09:00
oioki
marked this pull request as draft
September 30, 2026 09:11
… package Running python3 /healthcheck/http.py puts /healthcheck first on sys.path, so urllib's 'import http.client' picked up the script instead of the standard library and every healthcheck failed.
Coverage Results 📊✅ 22 passed | Total: 22 | Pass Rate: 100% | Execution Time: 10m 41s All tests are passing successfully. ✅ Patch coverage is 100.00% (no changed executable lines found; target 50%). Coverage diff@@ Coverage Diff @@
## master #4539 +/-##
==========================================
Coverage 95.54% 95.54% —%
==========================================
Files 5 5 —
Tracked lines 336 336 —
Branches 0 0 —
==========================================
Hits 321 321 —
Misses 15 15 —
Partials 0 0 —Generated by Coverage Action |
oioki
marked this pull request as ready for review
September 30, 2026 09:44
BYK
approved these changes
Sep 30, 2026
BYK
left a comment
Member
There was a problem hiding this comment.
Nice. I'd have preferred if this file was baked into the image but this is also nice.
Docker can inject HTTP_PROXY/http_proxy into containers from the client config, and urllib would then send the local health request through the proxy. The target is always the container itself, so bypass proxies, like the clickhouse and seaweedfs healthchecks already do.
Member
Author
Sanity check: healthcheck status right after container starts (sentry and snuba) |
Collaborator
|
This decreases docker Is that ok? |
Collaborator
Right. I don't think this is okay and we have to provide compatibility for this. |
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.
Replace the
webhealthcheck's bash/dev/tcpprobe withhealthcheck/check_http.py, and use the same script forsnuba-api. It'ssnuba/api_healthcheck.pygeneralized to take the URL as an argument: stdlib only, one-line errors, 2s timeout.The new
healthcheck/directory is mounted read-only at/healthcheck(like./geoip) throughx-sentry-defaultsand onsnuba-api, rather than putting a script into the./sentryconfig mount. TheSNUBA_API_HEALTHCHECK_URL/_TIMEOUToverrides are gone; override the wholetest:indocker-compose.override.ymlinstead.webstill checks the plain/_health/, not?full, so a down dependency doesn't markwebunhealthy and block everything that depends on it.Prep for moving the sentry image to a distroless base, which has no bash.