Skip to content

Add a way to disable admin profiler #1323

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion api/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ const (
// EnvMaxRequestSize sets the limit in bytes for any API request's length.
EnvMaxRequestSize = "FN_MAX_REQUEST_SIZE"

// EnvEnableAdminProfiler is used to enable the profiler for the admin API
EnvEnableAdminProfiler = "FN_ENABLE_ADMIN_PROFILER"

// DefaultLogFormat is text
DefaultLogFormat = "text"

Expand Down Expand Up @@ -1099,7 +1102,14 @@ func (s *Server) bindHandlers(ctx context.Context) {
admin.GET("/metrics", gin.WrapH(s.promExporter))
}

profilerSetup(admin, "/debug")
profilerEnabled, err := strconv.ParseBool(getEnv(EnvEnableAdminProfiler, "true"))
if err != nil {
profilerEnabled = true
}

if profilerEnabled {
profilerSetup(admin, "/debug")
}

// Pure runners don't have any route, they have grpc
switch s.nodeType {
Expand Down