Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Unified Diff: logdog/client/cmd/logdog_annotee/main.go

Issue 2548253004: Add profiling, integrate into Butler/Annotee. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « common/runtime/profiling/profiler.go ('k') | logdog/client/cmd/logdog_butler/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/client/cmd/logdog_annotee/main.go
diff --git a/logdog/client/cmd/logdog_annotee/main.go b/logdog/client/cmd/logdog_annotee/main.go
index ff148916923dbac90d2aaf801192452eaadfbe97..3c08996bbeaca5c3457b8836683730c58fc36fb2 100644
--- a/logdog/client/cmd/logdog_annotee/main.go
+++ b/logdog/client/cmd/logdog_annotee/main.go
@@ -18,6 +18,7 @@ import (
log "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/logging/gologger"
"github.com/luci/luci-go/common/proto/milo"
+ "github.com/luci/luci-go/common/runtime/profiling"
"github.com/luci/luci-go/logdog/client/annotee"
"github.com/luci/luci-go/logdog/client/annotee/executor"
"github.com/luci/luci-go/logdog/client/bootstrapResult"
@@ -66,6 +67,8 @@ type application struct {
prefix streamproto.StreamNameFlag
logdogHost string
+ prof profiling.Profiler
+
bootstrap *bootstrap.Bootstrap
}
@@ -160,6 +163,7 @@ func mainImpl(args []string) int {
fs := &flag.FlagSet{}
logFlags.AddFlags(fs)
+ a.prof.AddFlags(fs)
a.addToFlagSet(fs)
if err := fs.Parse(args); err != nil {
log.WithError(err).Errorf(a, "Failed to parse flags.")
@@ -217,6 +221,14 @@ func mainImpl(args []string) int {
a.annotationInterval = 0
}
+ // Start our profiling service. This will be a no-op if the profiler is not
+ // configured.
+ a.prof.Logger = log.Get(a)
+ if err := a.prof.Start(); err != nil {
+ log.WithError(err).Errorf(a, "Failed to start profiler.")
+ return runtimeErrorReturnCode
+ }
+
// Initialize our link generator, if we can.
e := executor.Executor{
Options: annotee.Options{
« no previous file with comments | « common/runtime/profiling/profiler.go ('k') | logdog/client/cmd/logdog_butler/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698