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

PMM-7110 Changed log level #219

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
7 changes: 6 additions & 1 deletion commands/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"gopkg.in/alecthomas/kingpin.v2"

"github.com/percona/pmm-admin/agentlocal"
"github.com/percona/pmm-admin/helpers"
)

var summaryResultT = ParseTemplate(`
Expand Down Expand Up @@ -283,7 +284,11 @@ func addPprofData(ctx context.Context, zipW *zip.Writer, skipServer bool) {
logrus.Infof("Getting %s ...", url)
data, err := getURL(ctx, url)
if err != nil {
logrus.Debugf("%s", err)
if res, _ := helpers.IsOnPmmServer(); res {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this to if on line 267

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

logrus.Warnf("%s", err)
} else {
logrus.Debugf("%s", err)
}
return
}

Expand Down
12 changes: 12 additions & 0 deletions helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,15 @@ func GetNodeName(node *nodes.GetNodeOKBody) (string, error) {
return "", errors.Wrap(errNoNode, "unknown node type")
}
}

// IsOnPmmServer returns true if pmm-admin is running on pmm-server.
func IsOnPmmServer() (bool, error) {
status, err := agentlocal.GetStatus(agentlocal.DoNotRequestNetworkInfo)
if err != nil {
return false, errors.Wrap(err, "can't get local pmm-agent status")
}

pmmServer := "pmm-server"

return status.NodeID == pmmServer && status.AgentID == pmmServer, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think checking for node id is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

}