-
Notifications
You must be signed in to change notification settings - Fork 459
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
register pprof endpoints for allocator #1408
Conversation
@@ -78,6 +79,7 @@ func NewServer(log logr.Logger, allocator allocation.Allocator, discoveryManager | |||
router.GET("/jobs", s.JobHandler) | |||
router.GET("/jobs/:job_id/targets", s.TargetsHandler) | |||
router.GET("/metrics", gin.WrapH(promhttp.Handler())) | |||
registerPprof(router.Group("/debug/pprof/")) |
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.
Would it make sense to design the registration in a way that the end point can be switched on and off?
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 there any reason for it? E.g. perf penalty?
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.
As far as I'm aware, just the import has no impact on performance.
When I do see flags for controlling it, it's usually because it's run on a separate port, as the main handler is exposed to untrusted clients or has auth requirements.
The allocator runs with trusted clients, metrics are on the same listener, leading me to the conclusion that there's no need to hide it behind a flag.
Thanks for adding this in :) Could you fill out a changelog for this too please? |
i've added one |
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.
LGTM, just a nit for the changelog generator
.chloggen/allocator-pprof.yaml
Outdated
component: target allocator | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: register pprof endpoints under /debug/pprof |
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.
Could you please start the sentence with a capital R
?
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.
done
* register pprof endpoints for allocator * changelog entry * full sentence for changelog
These are generally useful for tracking down performance issues.
Allocator clients are generally trusted, these shouldn't need to be on a separate endpoint.