[MM-54291] Add goroutines profile to support package (#24478)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7cd9780399
Коммит
35c1639ee3
@@ -42,6 +42,7 @@ func (a *App) GenerateSupportPacket(c *request.Context) []model.FileData {
|
|||||||
"notification log": a.getNotificationsLog,
|
"notification log": a.getNotificationsLog,
|
||||||
"cpu profile": a.createCPUProfile,
|
"cpu profile": a.createCPUProfile,
|
||||||
"heap profile": a.createHeapProfile,
|
"heap profile": a.createHeapProfile,
|
||||||
|
"goroutines": a.createGoroutineProfile,
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, fn := range functions {
|
for name, fn := range functions {
|
||||||
@@ -333,3 +334,18 @@ func (a *App) createHeapProfile(*request.Context) (*model.FileData, error) {
|
|||||||
}
|
}
|
||||||
return fileData, nil
|
return fileData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) createGoroutineProfile(_ *request.Context) (*model.FileData, error) {
|
||||||
|
var b bytes.Buffer
|
||||||
|
|
||||||
|
err := pprof.Lookup("goroutine").WriteTo(&b, 2)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "failed to lookup goroutine profile")
|
||||||
|
}
|
||||||
|
|
||||||
|
fileData := &model.FileData{
|
||||||
|
Filename: "goroutines",
|
||||||
|
Body: b.Bytes(),
|
||||||
|
}
|
||||||
|
return fileData, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ func TestGenerateSupportPacket(t *testing.T) {
|
|||||||
"notifications.log",
|
"notifications.log",
|
||||||
"cpu.prof",
|
"cpu.prof",
|
||||||
"heap.prof",
|
"heap.prof",
|
||||||
|
"goroutines",
|
||||||
}
|
}
|
||||||
for _, fileData := range fileDatas {
|
for _, fileData := range fileDatas {
|
||||||
require.NotNil(t, fileData)
|
require.NotNil(t, fileData)
|
||||||
@@ -132,6 +133,7 @@ func TestGenerateSupportPacket(t *testing.T) {
|
|||||||
"cpu.prof",
|
"cpu.prof",
|
||||||
"heap.prof",
|
"heap.prof",
|
||||||
"warning.txt",
|
"warning.txt",
|
||||||
|
"goroutines",
|
||||||
}
|
}
|
||||||
rFileNames = nil
|
rFileNames = nil
|
||||||
for _, fileData := range fileDatas {
|
for _, fileData := range fileDatas {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user