Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

PMM-5492 Added pprof query parameter to request in /logs.zip call. #220

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions commands/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ func addClientData(ctx context.Context, zipW *zip.Writer) {
}

// addServerData adds logs.zip from PMM Server to zip file.
func addServerData(ctx context.Context, zipW *zip.Writer) {
func addServerData(ctx context.Context, zipW *zip.Writer, usePprof bool) {
var pprof int32 = 0
pkadej marked this conversation as resolved.
Show resolved Hide resolved
if usePprof {
pprof = 1
}

var buf bytes.Buffer
_, err := client.Default.Server.Logs(&server.LogsParams{Context: ctx}, &buf)
_, err := client.Default.Server.Logs(&server.LogsParams{Context: ctx, Pprof: &pprof}, &buf)
pkadej marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
logrus.Errorf("%s", err)
return
Expand Down Expand Up @@ -264,7 +269,6 @@ func addPprofData(ctx context.Context, zipW *zip.Writer, skipServer bool) {
"client/pprof/pmm-agent": fmt.Sprintf("http://%s:%d/debug/pprof", agentlocal.Localhost, GlobalFlags.PMMAgentListenPort),
}
if !skipServer {
sources["server/pprof/pmm-managed"] = fmt.Sprintf("http://%s:7773/debug/pprof", agentlocal.Localhost)
sources["server/pprof/qan-api2"] = fmt.Sprintf("http://%s:9933/debug/pprof", agentlocal.Localhost)
}

Expand Down Expand Up @@ -332,7 +336,7 @@ func (cmd *summaryCommand) makeArchive(ctx context.Context) (err error) {
}

if !cmd.SkipServer {
addServerData(ctx, zipW)
addServerData(ctx, zipW, cmd.Pprof)
}

return //nolint:nakedret
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/AlekSi/pointer v1.2.0
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
github.com/go-openapi/runtime v0.24.0
github.com/percona/pmm v0.0.0-20220505164356-d8b4097358e1
github.com/percona/pmm v0.0.0-20220513204626-f4c3b5528a2e
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
github.com/percona/pmm v0.0.0-20220505164356-d8b4097358e1 h1:Iil3UzE49DPn4keMZ4apU396bzRJRQZvNGJc8jWRp08=
github.com/percona/pmm v0.0.0-20220505164356-d8b4097358e1/go.mod h1:k7HS59HPX33tmrSZGiNzUTYuLr0+a49F3BEZ48MAbuo=
github.com/percona/pmm v0.0.0-20220513204626-f4c3b5528a2e h1:Kar2MFskHJqXxY8C2fYw0JznEQu33H5c8bUszv2Fo4E=
github.com/percona/pmm v0.0.0-20220513204626-f4c3b5528a2e/go.mod h1:k7HS59HPX33tmrSZGiNzUTYuLr0+a49F3BEZ48MAbuo=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down