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

Unified Diff: server/internal/logdog/service/service.go

Issue 1863973002: LogDog: Update to archival V2. (Closed) Base URL: https://github.com/luci/luci-go@grpcutil-errors
Patch Set: Fix proto comment. Created 4 years, 8 months 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 | « server/internal/logdog/collector/collector.go ('k') | server/logdog/archive/archive.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/internal/logdog/service/service.go
diff --git a/server/internal/logdog/service/service.go b/server/internal/logdog/service/service.go
index d4b31a0631fe14cf8ed52d7b73043b7ceb48eb6d..bf1c4d581e0d7399d1cc40dfc99a8ea48c66f93c 100644
--- a/server/internal/logdog/service/service.go
+++ b/server/internal/logdog/service/service.go
@@ -56,6 +56,7 @@ type Service struct {
coordinatorInsecure bool
storageCredentialJSONPath string
cpuProfilePath string
+ heapProfilePath string
coord logdog.ServicesClient
config *config.Manager
@@ -99,6 +100,27 @@ func (s *Service) runImpl(c context.Context, f func(context.Context) error) erro
defer pprof.StopCPUProfile()
}
+ if p := s.heapProfilePath; p != "" {
+ defer func() {
+ fd, err := os.Create(p)
+ if err != nil {
+ log.Fields{
+ log.ErrorKey: err,
+ "path": p,
+ }.Warningf(c, "Failed to create heap profile output file.")
+ return
+ }
+ defer fd.Close()
+
+ if err := pprof.WriteHeapProfile(fd); err != nil {
+ log.Fields{
+ log.ErrorKey: err,
+ "path": p,
+ }.Warningf(c, "Failed to write heap profile.")
+ }
+ }()
+ }
+
// Configure our signal handler. It will listen for terminating signals and
// issue a shutdown signal if one is received.
signalC := make(chan os.Signal)
@@ -161,6 +183,8 @@ func (s *Service) addFlags(c context.Context, fs *flag.FlagSet) {
"If supplied, the path of a JSON credential file to load and use for storage operations.")
fs.StringVar(&s.cpuProfilePath, "cpu-profile-path", "",
"If supplied, enable CPU profiling and write the profile here.")
+ fs.StringVar(&s.heapProfilePath, "heap-profile-path", "",
+ "If supplied, enable CPU profiling and write the profile here.")
}
func (s *Service) initCoordinatorClient(c context.Context) (logdog.ServicesClient, error) {
« no previous file with comments | « server/internal/logdog/collector/collector.go ('k') | server/logdog/archive/archive.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698