Skip to content

Commit

Permalink
Merge branch 'v3' into PMM-11231-pmm-updates-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkubinec committed Mar 22, 2024
2 parents bcc34f2 + f9fd3a7 commit b59a3d6
Show file tree
Hide file tree
Showing 287 changed files with 5,265 additions and 5,306 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
* @percona/pmm-review-be
/agent/agents/postgres/ @JiriCtvrtka @percona/pmm-review-be
/agent/runner/ @artemgavrilov @percona/pmm-review-be
/api/ @BupycHuk @percona/pmm-review-be
/managed/services/checks/ @idoqo @percona/pmm-review-be
/update/ @BupycHuk @talhabinrizwan @percona/pmm-review-be
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ description: File a bug report
labels: ["bug", "triage"]
assignees:
- BupycHuk
- artemgavrilov
body:
- type: markdown
attributes:
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ description: Suggest an idea for this project
labels: ["feature", "triage"]
assignees:
- BupycHuk
- artemgavrilov
body:
- type: markdown
attributes:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
cache: false

- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -49,7 +49,7 @@ jobs:
${{ runner.os }}-go-build-
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
cache: false

- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -113,7 +113,7 @@ jobs:
${{ runner.os }}-go-build-
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
cache: false

- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -83,7 +83,7 @@ jobs:
${{ runner.os }}-go-build-
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:
lfs: true

- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go.version }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go.version }}-modules-
- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go.version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dockerhub-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
- uses: actions/checkout@v4

- name: Update Docker Hub Readme for perconalab/pmm-server
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: perconalab/pmm-server
readme-filepath: ./build/docker/server/README.md

- name: Update Docker Hub Readme for percona/pmm-server
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cache: false

- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -36,7 +36,7 @@ jobs:
${{ runner.os }}-go-build-
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
interval: 45
timeout: 1200
ignored: "WhiteSource License Check, WhiteSource Security Check"
ignored: "license/snyk (Percona Github Org), security/snyk (Percona Github Org)"
ref: ${{ github.event.pull_request.head.sha || github.sha }}

workflow_success:
Expand All @@ -150,7 +150,7 @@ jobs:

steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
uses: rtCamp/action-slack-notify@v2.2.1

workflow_failure:
if: ${{ failure() }}
Expand All @@ -168,4 +168,4 @@ jobs:

steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
uses: rtCamp/action-slack-notify@v2.2.1
4 changes: 2 additions & 2 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Enable Go build cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Enable Go modules cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qan-api2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cache: false

- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -50,7 +50,7 @@ jobs:
${{ runner.os }}-go-build-
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
grep -rl '!!! note alert alert-primary' ${{ github.workspace }}-CHANGELOG.txt | xargs --no-run-if-empty sed -i 's/\!\!\! note alert alert-primary "\(.*\)"/\> \:memo\: **\1**/g'
grep -rl '!!! note alert alert-primary' ${{ github.workspace }}-CHANGELOG.txt | xargs --no-run-if-empty sed -i 's/\!\!\! note alert alert-primary/\> \:memo\: **Note**/g'
- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt
draft: true
4 changes: 2 additions & 2 deletions .github/workflows/vmproxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cache: false

- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -50,7 +50,7 @@ jobs:
${{ runner.os }}-go-build-
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ linters:

# TODO: carefully review all the rules below and either fix the code
# or leave disabled and provide a reason why
- tagliatelle
- revive
#- tagliatelle
#- revive
- paralleltest
- gocognit
- tagalign
Expand Down
20 changes: 0 additions & 20 deletions .whitesource

This file was deleted.

10 changes: 6 additions & 4 deletions admin/agentlocal/agentlocal.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ func SetTransport(ctx context.Context, debug bool, port uint32) {
client.Default.SetTransport(transport)
}

// NetworkInfo represents information about the network.
type NetworkInfo bool

const (
RequestNetworkInfo NetworkInfo = true
DoNotRequestNetworkInfo NetworkInfo = false
Localhost = "127.0.0.1"
DefaultPMMAgentListenPort = 7777
RequestNetworkInfo NetworkInfo = true //nolint:revive
DoNotRequestNetworkInfo NetworkInfo = false //nolint:revive
Localhost = "127.0.0.1" //nolint:revive
DefaultPMMAgentListenPort = 7777 //nolint:revive
)

// ErrNotSetUp is returned by GetStatus when pmm-agent is running, but not set up.
Expand Down Expand Up @@ -81,6 +82,7 @@ type Status struct {
ConnectionUptime float32 `json:"connection_uptime"`
}

// AgentStatus represents the status of the agent.
type AgentStatus struct {
AgentID string `json:"agent_id"`
AgentType string `json:"agent_type"`
Expand Down
2 changes: 2 additions & 0 deletions admin/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (c *PMMAdminCommands) Run(ctx *kong.Context, globals *flags.GlobalFlags) er
return run(ctx, globals)
}

// GetGlobalFlags returns the global flags for PMMAdminCommands.
func (c *PMMAdminCommands) GetGlobalFlags() *flags.GlobalFlags {
return &c.GlobalFlags
}
Expand All @@ -81,6 +82,7 @@ type PMMCommands struct {
Completion commands.CompletionCommand `cmd:"" help:"Outputs shell code for initialising tab completions"`
}

// GetGlobalFlags returns the global flags for PMMAdminCommands.
func (c *PMMCommands) GetGlobalFlags() *flags.GlobalFlags {
return &c.GlobalFlags
}
Expand Down
2 changes: 1 addition & 1 deletion admin/cmd/pmm-admin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package main.
package main

import (
Expand Down
2 changes: 1 addition & 1 deletion admin/cmd/pmm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package main.
package main

import (
Expand Down
4 changes: 4 additions & 0 deletions admin/commands/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,19 @@ func ReadFromSource(src string) (*Credentials, error) {
return &creds, nil
}

// ErrorResponse defines the interface for error responses.
type ErrorResponse interface {
error
Code() int
}

// Error represents an error with additional information.
type Error struct {
Code int `json:"code"`
Error string `json:"error"`
}

// GetError converts an ErrorResponse to an Error.
func GetError(err ErrorResponse) Error {
v := reflect.ValueOf(err)
p := v.Elem().FieldByName("Payload")
Expand All @@ -131,6 +134,7 @@ func GetError(err ErrorResponse) Error {
}
}

// ParseTemplate parses the input text into a template.Template.
func ParseTemplate(text string) *template.Template {
t := template.New("").Option("missingkey=error")
return template.Must(t.Parse(strings.TrimSpace(text)))
Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_external_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type AddAgentExternalExporterCommand struct {
PushMetrics bool `help:"Enables push metrics model flow, it will be sent to the server by an agent"`
}

// RunCmd executes the AddAgentExternalExporterCommand and returns the result.
func (cmd *AddAgentExternalExporterCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_mongodb_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ type AddAgentMongodbExporterCommand struct {
LogLevel string `enum:"debug,info,warn,error,fatal" default:"warn" help:"Service logging level. One of: [debug, info, warn, error, fatal]"`
}

// RunCmd executes the AddAgentMongodbExporterCommand and returns the result.
func (cmd *AddAgentMongodbExporterCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_mysqld_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type AddAgentMysqldExporterCommand struct {
LogLevel string `enum:"debug,info,warn,error" default:"warn" help:"Service logging level. One of: [debug, info, warn, error]"`
}

// RunCmd executes the AddAgentMysqldExporterCommand and returns the result.
func (cmd *AddAgentMysqldExporterCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_node_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type AddAgentNodeExporterCommand struct {
LogLevel string `enum:"debug,info,warn,error" default:"warn" help:"Service logging level. One of: [debug, info, warn, error]"`
}

// RunCmd runs the command for AddAgentNodeExporterCommand.
func (cmd *AddAgentNodeExporterCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)
params := &agents.AddNodeExporterParams{
Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_pmm_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type AddPMMAgentCommand struct {
CustomLabels map[string]string `mapsep:"," help:"Custom user-assigned labels"`
}

// RunCmd executes the AddPMMAgentCommand and returns the result.
func (cmd *AddPMMAgentCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)
params := &agents.AddPMMAgentParams{
Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_postgres_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type AddAgentPostgresExporterCommand struct {
AutoDiscoveryLimit int32 `default:"0" placeholder:"NUMBER" help:"Auto-discovery will be disabled if there are more than that number of databases (default: server-defined, -1: always disabled)"`
}

// RunCmd executes the AddAgentPostgresExporterCommand and returns the result.
func (cmd *AddAgentPostgresExporterCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
1 change: 1 addition & 0 deletions admin/commands/inventory/add_agent_proxysql_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type AddAgentProxysqlExporterCommand struct {
LogLevel string `enum:"debug,info,warn,error,fatal" default:"warn" help:"Service logging level. One of: [debug, info, warn, error, fatal]"`
}

// RunCmd executes the AddAgentProxysqlExporterCommand and returns the result.
func (cmd *AddAgentProxysqlExporterCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)
params := &agents.AddProxySQLExporterParams{
Expand Down
Loading

0 comments on commit b59a3d6

Please sign in to comment.