Skip to content

Commit

Permalink
Merge branch 'v3' into v3-api-breaking-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
idoqo committed Feb 25, 2024
2 parents 2689b7b + 29e7cde commit 34fdae6
Show file tree
Hide file tree
Showing 249 changed files with 5,695 additions and 2,819 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 @@ -39,7 +39,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 @@ -48,7 +48,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 @@ -103,7 +103,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 @@ -112,7 +112,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 @@ -73,7 +73,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 @@ -82,7 +82,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
4 changes: 2 additions & 2 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
4 changes: 2 additions & 2 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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 @@ -49,7 +49,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 @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/vmproxy.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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ compose.yml
*.sw[o,p]

.env
.netrc

cli-tests/node_modules/
cli-tests/playwright-report/
Expand Down
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,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.AddAgentParams{
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.AddAgentParams{
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.AddAgentParams{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type AddAgentQANMongoDBProfilerAgentCommand 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 AddAgentQANMongoDBProfilerAgentCommand and returns the result.
func (cmd *AddAgentQANMongoDBProfilerAgentCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type AddAgentQANMySQLPerfSchemaAgentCommand struct {
LogLevel string `enum:"debug,info,warn,error,fatal" default:"warn" help:"Service logging level. One of: [debug, info, warn, error, fatal]"`
}

// RunCmd runs the command for AddAgentQANMySQLPerfSchemaAgentCommand.
func (cmd *AddAgentQANMySQLPerfSchemaAgentCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type AddAgentQANMySQLSlowlogAgentCommand 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 AddAgentQANMySQLSlowlogAgentCommand and returns the result.
func (cmd *AddAgentQANMySQLSlowlogAgentCommand) RunCmd() (commands.Result, error) {
customLabels := commands.ParseCustomLabels(cmd.CustomLabels)

Expand Down
Loading

0 comments on commit 34fdae6

Please sign in to comment.