-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create multiprocess files with process uuid #694
Closed
ethervoid
wants to merge
1
commit into
prometheus:master
from
ethervoid:568_use_process_uuid_for_multiprocess
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this safe? Wouldn't this reset some counters partially, therefore producing bad data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't hash() the pythonic way to get a hash?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only affect files for a destroyed/stopped worker. I can see the point of not being able to scrape the data because we're removing the files so we can use the other approach which is to mark them as defunct and do the cleanup after a number of minutes/hours.
I'm old school haha I'll change to hash instead of hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that if you just remove an old file that contained say 100 increments of a counter then when you go to read all of the files during the next scrape your new value will be 100 lower which
rate
and other counter functions in prometheus interpret as a reset.Anything with a counter component (histograms, though not gauge histograms, sum and count fields on a summary, etc...), will need to be merged and have those old increments kept around somewhere. Ideally in one file instead of the current behavior of keeping more and more files on disk as PIDs churn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thank you for the explanation, but shouldn't be that scenario happening when the server is restarted and all the files from the metrics folder are wiped? I thought Prometheus server, once the scrape is done, takes care of it and doesn't need the data in the target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with the current code happens when a process is stopped and cleaned up, but the server is not wiped. You then end up in a state where there is a partial reset (counter value is lowered just by the amount of requests handled by the now stopped and cleaned up process) which can cause large issues with
rate
calculations.How a partial reset is handled is that if a counter goes from 100 to 80 on cleanup (partial reset) it is assumed by Prometheus that the counter went from 100 to 0 to 80, causing a big spike during that period of time, when actually no requests may have come through.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I knew about the reset stuff but I thought Prometheus doesn't take the disappeared metric as a 0 but just as disappeared and didn't take into account. Not very much into the internals of Prometheus yet.
So, what would be the suggestion to clean up those files safely? We're removing the files if there is a fork when the mmap object is closed but when the process is dead we can only mark them as defunct and then do the clean up later or something like that? That wouldn't fix the problem because in environments with a high process recycling they're going to hit the same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One idea is to merge the values into a single file, for example #518 (which is unsafe and has not been updated in awhile). It would be necessary to make sure there are not race conditions or other issues with any new approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Then this goes beyond my current knowledge of prometheus. I'll close this pR then. Thank you for your time