mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
Add flag for block profiling
Fixes #1672 Test by adding `--app.block.profile.rate=1`, running scope in multi-tenant mode and browsing to http://<scope-url>/debug/pprof/
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
_ "net/http/pprof"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -199,6 +200,7 @@ func pipeRouterFactory(userIDer multitenant.UserIDer, pipeRouterURL, consulInf s
|
||||
func appMain(flags appFlags) {
|
||||
setLogLevel(flags.logLevel)
|
||||
setLogFormatter(flags.logPrefix)
|
||||
runtime.SetBlockProfileRate(flags.blockProfileRate)
|
||||
|
||||
defer log.Info("app exiting")
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
@@ -111,6 +111,8 @@ type appFlags struct {
|
||||
memcachedExpiration time.Duration
|
||||
userIDHeader string
|
||||
|
||||
blockProfileRate int
|
||||
|
||||
awsCreateTables bool
|
||||
consulInf string
|
||||
}
|
||||
@@ -197,6 +199,8 @@ func main() {
|
||||
flag.StringVar(&flags.app.memcachedService, "app.memcached.service", "memcached", "SRV service used to discover memcache servers.")
|
||||
flag.StringVar(&flags.app.userIDHeader, "app.userid.header", "", "HTTP header to use as userid")
|
||||
|
||||
flag.IntVar(&flags.app.blockProfileRate, "app.block.profile.rate", 0, "If more than 0, enable block profiling. The profiler aims to sample an average of one blocking event per rate nanoseconds spent blocked.")
|
||||
|
||||
flag.BoolVar(&flags.app.awsCreateTables, "app.aws.create.tables", false, "Create the tables in DynamoDB")
|
||||
flag.StringVar(&flags.app.consulInf, "app.consul.inf", "", "The interface who's address I should advertise myself under in consul")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user