mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-54291] Add goroutines profile to support package (#24478)
This commit is contained in:
parent
7cd9780399
commit
35c1639ee3
@ -42,6 +42,7 @@ func (a *App) GenerateSupportPacket(c *request.Context) []model.FileData {
|
||||
"notification log": a.getNotificationsLog,
|
||||
"cpu profile": a.createCPUProfile,
|
||||
"heap profile": a.createHeapProfile,
|
||||
"goroutines": a.createGoroutineProfile,
|
||||
}
|
||||
|
||||
for name, fn := range functions {
|
||||
@ -333,3 +334,18 @@ func (a *App) createHeapProfile(*request.Context) (*model.FileData, error) {
|
||||
}
|
||||
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",
|
||||
"cpu.prof",
|
||||
"heap.prof",
|
||||
"goroutines",
|
||||
}
|
||||
for _, fileData := range fileDatas {
|
||||
require.NotNil(t, fileData)
|
||||
@ -132,6 +133,7 @@ func TestGenerateSupportPacket(t *testing.T) {
|
||||
"cpu.prof",
|
||||
"heap.prof",
|
||||
"warning.txt",
|
||||
"goroutines",
|
||||
}
|
||||
rFileNames = nil
|
||||
for _, fileData := range fileDatas {
|
||||
|
Loading…
Reference in New Issue
Block a user