[MM-54289] Add heap profile to support package (#24476)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b7b08dbc0f
Коммит
153ebc31d7
@@ -4,9 +4,11 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/go-multierror"
|
||||
@@ -33,6 +35,7 @@ func (a *App) GenerateSupportPacket(c *request.Context) []model.FileData {
|
||||
"config": a.createSanitizedConfigFile,
|
||||
"mattermost log": a.getMattermostLog,
|
||||
"notification log": a.getNotificationsLog,
|
||||
"heap profile": a.createHeapProfile,
|
||||
}
|
||||
|
||||
for name, fn := range functions {
|
||||
@@ -290,3 +293,18 @@ func (a *App) createSanitizedConfigFile(_ *request.Context) (*model.FileData, er
|
||||
}
|
||||
return fileData, nil
|
||||
}
|
||||
|
||||
func (a *App) createHeapProfile(*request.Context) (*model.FileData, error) {
|
||||
var b bytes.Buffer
|
||||
|
||||
err := pprof.Lookup("heap").WriteTo(&b, 0)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to lookup heap profile")
|
||||
}
|
||||
|
||||
fileData := &model.FileData{
|
||||
Filename: "heap.prof",
|
||||
Body: b.Bytes(),
|
||||
}
|
||||
return fileData, nil
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user