scout_apm_python
scout_apm_python copied to clipboard
Make samplers thread sleep call avoid drift
Currently SamplersThread always sleeps 60 seconds between gathering data and posting the event.
This means it doesn't send events every 60 seconds but instead every (60 + data collection time) seconds, so it will end up drifting from the exact minute. This could be frustrating for graphing things accurately.
It should adjust how long it sleeps to try keep running once per 60 seconds.
the thread implementation might add the process time also along with the delay time , This also incurs another inherent problem and that is "Time Drift" ,because that thread now doesn't work after 60s but after 60+process delay time which can be of some milliseconds . This drift might integrate to a very large chunk of time in a long run.
So let's say that you are using java , so better use scheduleatfixedrate that starts exactly after 60s ignoring the process delay also will remove any time drifts (if any).