Repository navigation
docs: say when to wipe PROMETHEUS_MULTIPROC_DIR and what breaks if it's wiped later - #1270
Open
naveensheejachacko wants to merge 1 commit into
Open
naveensheejachacko wants to merge 1 commit into
naveensheejachacko wants to merge 1 commit into
Conversation
…'s wiped later A metric without labels opens its process's <type>_<pid>.db file when it is defined. If the multiprocess directory is wiped after that, for example in a Celery worker_init handler, the process keeps writing to the deleted file and its metrics of that type stop being reported. Forked workers are unaffected, which is why prometheus#1123 only showed up in a threaded Celery worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Naveen Chacko <naveensheejachacko@gmail.com>
This branch has not been deployed
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.
Closes #1123 (docs side; I posted the root cause and a reproduction on the issue).
The multiprocess docs say the directory "must be wiped between process/Gunicorn runs (before startup is recommended)", but they don't say what happens when it's wiped later. In #1123 a threaded Celery worker silently lost its metrics while the prefork workers were fine.
The cause: a metric without labels opens its process's
<type>_<pid>.dbfile when it's defined, usually at import time. If the directory is wiped after that (for example in a Celeryworker_inithandler), the process keeps writing to the deleted file, and every metric of that type in the process stops being reported, including labelled metrics first used after the wipe. Processes forked after the wipe open new files, so prefork pools and Gunicorn workers are unaffected.This PR:
threads/solopools) can recognise it.Docs only; no code changes. Recovering automatically would need a
staton every write.@csmarchbanks
🤖 Generated with Claude Code