Repository navigation
scrape: update scrape offset to follow wall-clock - #61
Open
waltherlee wants to merge 1 commit into
Open
waltherlee wants to merge 1 commit into
waltherlee wants to merge 1 commit into
Conversation
…art instant Signed-off-by: Walther Lee <walthere.lee@gmail.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.
Description
Update scrapes to anchor each target's first scrape to wall-clock time, similar to Go's
Target.offset, instead ofInstantafter the scrape manager starts.The hash offset already distributes targets across the interval so they aren't all scraped at once. Anchoring it to wall-clock time also keeps each target on the same slot when the scraper restarts or when a target drops out of discovery and comes back, so the scrape grid doesn't shift.
This crate doesn't support config reloads yet, so this only changes restarts and targets re-added through
UpdateTargets.Example
Take a target with
scrape_interval: 1mand offset of 17s. It drops out of discovery after its 12:00:17 scrape and comes back at 12:00:40.Before, the next scrape was 17s after it came back, at 12:00:57, and the target stayed on
:57:The gap could be anywhere from almost 0 to almost 2 intervals.
Now the next scrape is the next wall-clock time at
:17, so the target stays on its original grid:Testing
wall_clock_anchored_delay_matches_go_target_offset: checks the delay calculation.first_due_phase_is_anchored_to_wall_clock_not_start_time: runs the same targets from unrelated start instants and wall-clock times.