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 all commits
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
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, HTTPClient: nil}, &buf)
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 @@ -14,7 +14,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-20220520150831-23069cdf1bb8
github.com/percona/pmm v0.0.0-20220530213957-dc4793335a14
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 @@ -113,8 +113,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-20220520150831-23069cdf1bb8 h1:P5iuV4GRUIviRg/5/FM6ZOKdiBPdwUPbrHld/epM3hk=
github.com/percona/pmm v0.0.0-20220520150831-23069cdf1bb8/go.mod h1:gr+WLd8clEAe2xMFgsGhpw9ziZc2UCWcfy6d3M6Aq00=
github.com/percona/pmm v0.0.0-20220530213957-dc4793335a14 h1:NvhRMv1rftqvSpzmFHQlmSPFIjsUxv7Ii4anCnV46Dk=
github.com/percona/pmm v0.0.0-20220530213957-dc4793335a14/go.mod h1:gr+WLd8clEAe2xMFgsGhpw9ziZc2UCWcfy6d3M6Aq00=
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