Skip to content
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

Merged
merged 2 commits into from
Oct 12, 2021

Conversation

zecke
Copy link
Contributor

@zecke zecke commented Oct 10, 2021

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).

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@brancz brancz left a 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!

@brancz
Copy link
Member

brancz commented Oct 11, 2021

Looks like there's a test that needs to be adapted.

Comment on lines 34 to 42
const (
pprofProcessCpu string = "process_cpu"
)
Copy link
Member

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. :)

Copy link
Contributor Author

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).

Copy link
Member

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>
Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you!

@brancz brancz merged commit 638bcb7 into parca-dev:main Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants