Add a CLI flag to configure the service name

This commit is contained in:
Marcus Cobden
2018-08-09 14:06:57 +01:00
parent 2a87edd595
commit 02ebac68e4
2 changed files with 3 additions and 1 deletions

View File

@@ -203,7 +203,7 @@ func appMain(flags appFlags) {
setLogFormatter(flags.logPrefix)
runtime.SetBlockProfileRate(flags.blockProfileRate)
traceCloser := tracing.NewFromEnv("scope-app")
traceCloser := tracing.NewFromEnv(fmt.Sprintf("scope-%s", flags.serviceName))
defer traceCloser.Close()
defer log.Info("app exiting")

View File

@@ -167,6 +167,7 @@ type appFlags struct {
userIDHeader string
externalUI bool
metricsGraphURL string
serviceName string
blockProfileRate int
@@ -369,6 +370,7 @@ func setupFlags(flags *flags) {
flag.StringVar(&flags.app.userIDHeader, "app.userid.header", "", "HTTP header to use as userid")
flag.BoolVar(&flags.app.externalUI, "app.externalUI", false, "Point to externally hosted static UI assets")
flag.StringVar(&flags.app.metricsGraphURL, "app.metrics-graph", "", "Enable extended metrics graph by providing a templated URL (supports :orgID and :query). Example: --app.metric-graph=/prom/:orgID/notebook/new")
flag.StringVar(&flags.app.serviceName, "app.service-name", "app", "The name for this service which should be reported in instrumentation")
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.")