holmes
holmes copied to clipboard
Main binary filename not available.
生成的文件都是.log结尾的 使用linux和mac都尝试go tool pprof 都有一样的问题
`func systemInit() { err := service.Init() if err != nil { glog.Fatalf("system fatal err:%s", err) } configs.InitDb() appstore.Init() appdev.Init() //authcheck.Init()
r := &ReporterImpl{}
h, _ := holmes.New(
holmes.WithProfileReporter(r),
holmes.WithCollectInterval("5s"),
holmes.WithDumpPath("/tmp"),
holmes.WithTextDump(),
holmes.WithCPUDump(10, 25, 80, time.Minute),
holmes.WithMemDump(30, 25, 80, time.Minute),
holmes.WithGCHeapDump(10, 20, 40, time.Minute),
holmes.WithGoroutineDump(500, 25, 20000, 0, time.Minute),
holmes.WithCGroup(true), // set cgroup to true
)
h.EnableCPUDump().
EnableGoroutineDump().
EnableMemDump().
EnableGCHeapDump().Start()
}
type ReporterImpl struct{}
func (r *ReporterImpl) Report(pType string, filename string, reason holmes.ReasonType, eventID string, sampleTime time.Time, pprofBytes []byte, scene holmes.Scene) error { // do something glog.Infof("report to minio reporter %s", filename) fr := bytes.NewReader(pprofBytes) minioClient := configs.Get().MinioClientPool.Get() _, err := minioClient.PutObject(context.Background(), configs.Get().DownloadBucket, filepath.Join("wxtest", filename), fr, int64(len(pprofBytes)), minio.PutObjectOptions{ContentType: pType}) if err != nil { glog.Errorf("Reporter holmes.Report error %v", err) } return err }`