-
Notifications
You must be signed in to change notification settings - Fork 217
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
config: Validate timeout and interval of the scrape configuration #275
Conversation
55f6038
to
9f7ed78
Compare
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.
Thank you so much! Looks good!
Looks like there's a test that needs to be adapted. |
9f7ed78
to
e63b648
Compare
pkg/config/config.go
Outdated
const ( | ||
pprofProcessCpu string = "process_cpu" | ||
) |
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.
If we want constants for this, I'd say let's go for constants for all of these strings. :)
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.
Any preference? I didn't want to hardcode process_cpu in two places (given the names already changed once).
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.
Yep, that makes sense. Let's make all of them a constant, as you've already started too. 👍
In general we want to stick to the configured interval and don't overrun because of slow or timing out scraping. Go's /debug/pprof/profile endpoint will start profiling when being invoked, has no support for concurrency and the timeout can only be configured in seconds. The existing code alternated between using "Seconds", "Delta"+ScrapeInterval but none of these work correctly when enforcing timeout <= interval. Make sure that "seconds" < ScrapeTimeout <= ScrapeInterval and adjust the default configuration to honor this. In the long run we should consider treating this endpoint entirely different to the others (e.g. jitter scraping instead of sticking to interval, profile for a longer duration). Signed-off-by: Holger Hans Peter Freyther <holger@moiji-mobile.com>
e63b648
to
07024bb
Compare
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.
Awesome! Thank you!
In general we want to stick to the configured interval and don't
overrun because of slow or timing out scraping.
Go's /debug/pprof/profile endpoint will start profiling when being
invoked, has no support for concurrency and the timeout can only
be configured in seconds. The existing code alternated between using
"Seconds", "Delta"+ScrapeInterval but none of these work correctly
when enforcing timeout <= interval.
Make sure that "seconds" < ScrapeTimeout <= ScrapeInterval and adjust
the default configuration to honor this. In the long run we should
consider treating this endpoint entirely different to the others (e.g.
jitter scraping instead of sticking to interval, profile for a longer
duration).