diff --git a/.github/workflows/admin.yml b/.github/workflows/admin.yml index fbd0d26e49..625e33324a 100644 --- a/.github/workflows/admin.yml +++ b/.github/workflows/admin.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go release uses: actions/setup-go@v4 @@ -95,7 +95,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go release uses: actions/setup-go@v4 diff --git a/.github/workflows/agent.yml b/.github/workflows/agent.yml index 8edef91181..46bf271491 100644 --- a/.github/workflows/agent.yml +++ b/.github/workflows/agent.yml @@ -63,7 +63,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go release uses: actions/setup-go@v4 diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index 3b56e28bbb..431a7f83cc 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -52,7 +52,7 @@ jobs: echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV echo "$HOME/gotip/bin" >> $GITHUB_PATH - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: lfs: true diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 0000000000..3e573ed183 --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,24 @@ +name: Dependabot +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot: + name: Enable auto-merge + runs-on: ubuntu-20.04 + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 9d44ae50e7..bcba69877d 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.branch }} diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 8fe9398359..851406bcef 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: API uses: readmeio/rdme@v8 diff --git a/.github/workflows/dockerhub-readme.yml b/.github/workflows/dockerhub-readme.yml index bb739540c3..b2f0e71574 100644 --- a/.github/workflows/dockerhub-readme.yml +++ b/.github/workflows/dockerhub-readme.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest environment: Production steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Docker Hub Readme for perconalab/pmm-server uses: peter-evans/dockerhub-description@v3 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5a44a430a6..5ecd013a33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go release uses: actions/setup-go@v4 diff --git a/.github/workflows/managed.yml b/.github/workflows/managed.yml index fcb0678b44..807377494b 100644 --- a/.github/workflows/managed.yml +++ b/.github/workflows/managed.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Enable Go build cache if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }} diff --git a/.github/workflows/qan-api2.yml b/.github/workflows/qan-api2.yml index c16b984bd2..328edd972b 100644 --- a/.github/workflows/qan-api2.yml +++ b/.github/workflows/qan-api2.yml @@ -32,7 +32,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go release uses: actions/setup-go@v4 diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml index d04acadc5e..2acc444c22 100644 --- a/.github/workflows/sbom.yml +++ b/.github/workflows/sbom.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create SBOM for PMM uses: anchore/sbom-action@v0 @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create SBOM for vmproxy uses: anchore/sbom-action@v0 diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index a1ea10e660..bbe76d37df 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -42,7 +42,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Docker Up run: docker compose up -d diff --git a/.github/workflows/vmproxy.yml b/.github/workflows/vmproxy.yml index 5bbbb6196d..ed81580f61 100644 --- a/.github/workflows/vmproxy.yml +++ b/.github/workflows/vmproxy.yml @@ -32,7 +32,7 @@ jobs: steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go release uses: actions/setup-go@v4 diff --git a/.golangci.yml b/.golangci.yml index 645ad885e3..ff07ed391b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -29,7 +29,7 @@ linters-settings: godot: capital: true - period: false + period: true scope: toplevel exclude: - go-sumtype:decl diff --git a/admin/cli/cli.go b/admin/cli/cli.go index 36e5d4615f..8b5def5d9a 100644 --- a/admin/cli/cli.go +++ b/admin/cli/cli.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package cli stores cli configuration and common logic for commands +// Package cli stores cli configuration and common logic for commands. package cli import ( diff --git a/admin/cli/flags/global.go b/admin/cli/flags/global.go index 8714d8023a..9a2e42f71b 100644 --- a/admin/cli/flags/global.go +++ b/admin/cli/flags/global.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package flags holds global flags +// Package flags holds global flags. package flags import ( diff --git a/admin/cmd/bootstrap.go b/admin/cmd/bootstrap.go index 369a3a3fa4..44b96b0fe0 100644 --- a/admin/cmd/bootstrap.go +++ b/admin/cmd/bootstrap.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package cmd holds common logic used by commands +// Package cmd holds common logic used by commands. package cmd import ( diff --git a/admin/commands/base/setup.go b/admin/commands/base/setup.go index be6b76fd89..35d35b82d4 100644 --- a/admin/commands/base/setup.go +++ b/admin/commands/base/setup.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package base provides helpers for all commands +// Package base provides helpers for all commands. package base import ( diff --git a/admin/commands/pmm/client/base.go b/admin/commands/pmm/client/base.go index 05e4f3f511..24da73a78d 100644 --- a/admin/commands/pmm/client/base.go +++ b/admin/commands/pmm/client/base.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package client holds the "pmm client" command +// Package client holds the "pmm client" command. package client import "github.com/percona/pmm/admin/commands" diff --git a/admin/commands/pmm/server/base.go b/admin/commands/pmm/server/base.go index 600f4e8233..795be8f5f8 100644 --- a/admin/commands/pmm/server/base.go +++ b/admin/commands/pmm/server/base.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package server holds the "pmm server" command +// Package server holds the "pmm server" command. package server import ( diff --git a/admin/commands/pmm/server/docker/base.go b/admin/commands/pmm/server/docker/base.go index 643fae3d71..b3e67bf930 100644 --- a/admin/commands/pmm/server/docker/base.go +++ b/admin/commands/pmm/server/docker/base.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package docker holds the "pmm server install docker" command +// Package docker holds the "pmm server install docker" command. package docker import ( diff --git a/admin/commands/pmm/server/docker/base_test.go b/admin/commands/pmm/server/docker/base_test.go index a3c778e47f..90a366f53e 100644 --- a/admin/commands/pmm/server/docker/base_test.go +++ b/admin/commands/pmm/server/docker/base_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package docker holds the "pmm server install docker" command +// Package docker holds the "pmm server install docker" command. package docker import ( diff --git a/admin/commands/summary.go b/admin/commands/summary.go index 694c1ac287..998f177d13 100644 --- a/admin/commands/summary.go +++ b/admin/commands/summary.go @@ -254,7 +254,7 @@ func getURL(ctx context.Context, url string) ([]byte, error) { return b, nil } -// downloadFile download file and includes into zip file +// downloadFile download file and includes into zip file. func downloadFile(ctx context.Context, zipW *zip.Writer, url, fileName string) error { b, err := getURL(ctx, url) if err != nil { diff --git a/admin/pkg/bubbles/progress/size.go b/admin/pkg/bubbles/progress/size.go index ed95e48265..2dc15d05d5 100644 --- a/admin/pkg/bubbles/progress/size.go +++ b/admin/pkg/bubbles/progress/size.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package progress contains progress bar programs to be rendered with BubbleTea +// Package progress contains progress bar programs to be rendered with BubbleTea. package progress import ( diff --git a/admin/pkg/bubbles/styles/styles.go b/admin/pkg/bubbles/styles/styles.go index 8f5c987f4e..fad7bfdf87 100644 --- a/admin/pkg/bubbles/styles/styles.go +++ b/admin/pkg/bubbles/styles/styles.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package styles holds common styles for BubbleTea programs +// Package styles holds common styles for BubbleTea programs. package styles import "github.com/charmbracelet/lipgloss" diff --git a/admin/pkg/client/client.go b/admin/pkg/client/client.go index eaa0132d13..cc57ffa3e7 100644 --- a/admin/pkg/client/client.go +++ b/admin/pkg/client/client.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package client provides common methods for working with pmm-client +// Package client provides common methods for working with pmm-client. package client import ( diff --git a/admin/pkg/client/tarball/tarball.go b/admin/pkg/client/tarball/tarball.go index a6dd297a4c..39ce808ff5 100644 --- a/admin/pkg/client/tarball/tarball.go +++ b/admin/pkg/client/tarball/tarball.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package tarball holds logic for pmm-client tarball specific operations +// Package tarball holds logic for pmm-client tarball specific operations. package tarball import ( diff --git a/admin/pkg/common/common.go b/admin/pkg/common/common.go index de6c1340fa..e9611c1474 100644 --- a/admin/pkg/common/common.go +++ b/admin/pkg/common/common.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package common holds common methods used in admin +// Package common holds common methods used in admin. package common import ( diff --git a/admin/pkg/docker/docker.go b/admin/pkg/docker/docker.go index 75921ef2a9..04d7fdb7ac 100644 --- a/admin/pkg/docker/docker.go +++ b/admin/pkg/docker/docker.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package docker stores common functions for working with Docker +// Package docker stores common functions for working with Docker. package docker import ( diff --git a/agent/agentlocal/agent_local.go b/agent/agentlocal/agent_local.go index d5a3c6e9c3..60a6e3325f 100644 --- a/agent/agentlocal/agent_local.go +++ b/agent/agentlocal/agent_local.go @@ -349,7 +349,7 @@ var ( _ agentlocalpb.AgentLocalServer = (*Server)(nil) ) -// addData add data to zip file +// addData add data to zip file. func addData(zipW *zip.Writer, name string, data []byte) error { f, err := zipW.Create(name) if err != nil { diff --git a/agent/agents/cache/cache.go b/agent/agents/cache/cache.go index 41c506981f..f7aba164a5 100644 --- a/agent/agents/cache/cache.go +++ b/agent/agents/cache/cache.go @@ -47,7 +47,7 @@ type Cache struct { trimmedN uint } -// cacheItem is an element stored in Cache +// cacheItem is an element stored in Cache. type cacheItem struct { key interface{} value interface{} diff --git a/agent/agents/mongodb/mongodb.go b/agent/agents/mongodb/mongodb.go index 0c98a8e75e..6f34fc74be 100644 --- a/agent/agents/mongodb/mongodb.go +++ b/agent/agents/mongodb/mongodb.go @@ -119,7 +119,7 @@ func (m *MongoDB) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*MongoDB)(nil) ) diff --git a/agent/agents/mysql/perfschema/history.go b/agent/agents/mysql/perfschema/history.go index 7fc3c30a20..5f35ec9a2b 100644 --- a/agent/agents/mysql/perfschema/history.go +++ b/agent/agents/mysql/perfschema/history.go @@ -25,7 +25,7 @@ import ( "github.com/percona/pmm/agent/agents/cache" ) -// historyCache is a wrapper for cache.Cache to use only with historyMap type +// historyCache is a wrapper for cache.Cache to use only with historyMap type. type historyCache struct { cache *cache.Cache } diff --git a/agent/agents/mysql/perfschema/perfschema.go b/agent/agents/mysql/perfschema/perfschema.go index 949d277e08..9dc5500dbe 100644 --- a/agent/agents/mysql/perfschema/perfschema.go +++ b/agent/agents/mysql/perfschema/perfschema.go @@ -47,7 +47,7 @@ type ( summaryMap map[string]*eventsStatementsSummaryByDigest ) -// mySQLVersion contains +// mySQLVersion contains. type mySQLVersion struct { version float64 vendor string @@ -107,7 +107,7 @@ type Params struct { TLSSkipVerify bool } -// newPerfSchemaParams holds all required parameters to instantiate a new PerfSchema +// newPerfSchemaParams holds all required parameters to instantiate a new PerfSchema. type newPerfSchemaParams struct { Querier *reform.Querier DBCloser io.Closer @@ -520,7 +520,7 @@ func (m *PerfSchema) Collect(ch chan<- prometheus.Metric) { } } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*PerfSchema)(nil) ) diff --git a/agent/agents/mysql/perfschema/summaries.go b/agent/agents/mysql/perfschema/summaries.go index b0f8a06e48..ffd7afd9aa 100644 --- a/agent/agents/mysql/perfschema/summaries.go +++ b/agent/agents/mysql/perfschema/summaries.go @@ -25,7 +25,7 @@ import ( "github.com/percona/pmm/agent/agents/cache" ) -// summaryCache is a wrapper for cache.Cache to use only with summaryMap type +// summaryCache is a wrapper for cache.Cache to use only with summaryMap type. type summaryCache struct { cache *cache.Cache } diff --git a/agent/agents/mysql/slowlog/parser/continuous_file_reader.go b/agent/agents/mysql/slowlog/parser/continuous_file_reader.go index f49b1be406..7904d08739 100644 --- a/agent/agents/mysql/slowlog/parser/continuous_file_reader.go +++ b/agent/agents/mysql/slowlog/parser/continuous_file_reader.go @@ -182,7 +182,7 @@ func (r *ContinuousFileReader) Metrics() *ReaderMetrics { return &m } -// check interfaces +// check interfaces. var ( _ Reader = (*ContinuousFileReader)(nil) ) diff --git a/agent/agents/mysql/slowlog/parser/logger_test.go b/agent/agents/mysql/slowlog/parser/logger_test.go index 98df8c5dd2..49fbf171f9 100644 --- a/agent/agents/mysql/slowlog/parser/logger_test.go +++ b/agent/agents/mysql/slowlog/parser/logger_test.go @@ -40,5 +40,5 @@ func (tl *testLogger) Tracef(format string, v ...interface{}) { tl.t.Logf("TRACE: "+format, v...) } -// check interface +// check interface. var _ Logger = (*testLogger)(nil) diff --git a/agent/agents/mysql/slowlog/parser/simple_file_reader.go b/agent/agents/mysql/slowlog/parser/simple_file_reader.go index 25a360399a..38f6ab0919 100644 --- a/agent/agents/mysql/slowlog/parser/simple_file_reader.go +++ b/agent/agents/mysql/slowlog/parser/simple_file_reader.go @@ -76,7 +76,7 @@ func (r *SimpleFileReader) Metrics() *ReaderMetrics { return &m } -// check interfaces +// check interfaces. var ( _ Reader = (*SimpleFileReader)(nil) ) diff --git a/agent/agents/mysql/slowlog/slowlog.go b/agent/agents/mysql/slowlog/slowlog.go index 2c7f359031..05081a68f9 100644 --- a/agent/agents/mysql/slowlog/slowlog.go +++ b/agent/agents/mysql/slowlog/slowlog.go @@ -724,7 +724,7 @@ func (s *SlowLog) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*SlowLog)(nil) ) diff --git a/agent/agents/noop/noop.go b/agent/agents/noop/noop.go index 8578cfce01..3941eb5aed 100644 --- a/agent/agents/noop/noop.go +++ b/agent/agents/noop/noop.go @@ -66,7 +66,7 @@ func (n *NoOp) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*NoOp)(nil) ) diff --git a/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go b/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go index b5d4b80485..22f84a0f74 100644 --- a/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go +++ b/agent/agents/postgres/pgstatmonitor/pgstatmonitor.go @@ -724,5 +724,5 @@ func (m *PGStatMonitorQAN) Collect(ch chan<- prometheus.Metric) { // This method is needed to satisfy interface. } -// check interfaces +// check interfaces. var _ prometheus.Collector = (*PGStatMonitorQAN)(nil) diff --git a/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go b/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go index a3f865d70f..bd67c58502 100644 --- a/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go +++ b/agent/agents/postgres/pgstatmonitor/pgstatmonitor_models.go @@ -34,7 +34,7 @@ var ( v08 = version.Must(version.NewVersion("0.8")) ) -// pgStatMonitor represents a row in pg_stat_monitor view +// pgStatMonitor represents a row in pg_stat_monitor view. type pgStatMonitor struct { // PGSM < 0.6.0 DBID int64 @@ -348,7 +348,7 @@ func (s *pgStatMonitor) View() reform.View { //nolint:ireturn } var ( - // Check interfaces + // Check interfaces. _ reform.Struct = (*pgStatMonitor)(nil) _ fmt.Stringer = (*pgStatMonitor)(nil) ) diff --git a/agent/agents/postgres/pgstatstatements/pgstatstatements.go b/agent/agents/postgres/pgstatstatements/pgstatstatements.go index 2a86d4e8a4..d880eebab8 100644 --- a/agent/agents/postgres/pgstatstatements/pgstatstatements.go +++ b/agent/agents/postgres/pgstatstatements/pgstatstatements.go @@ -423,7 +423,7 @@ func (m *PGStatStatementsQAN) Collect(ch chan<- prometheus.Metric) { } } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*PGStatStatementsQAN)(nil) ) diff --git a/agent/agents/postgres/pgstatstatements/utils.go b/agent/agents/postgres/pgstatstatements/utils.go index d1c62f5414..71c59b5a06 100644 --- a/agent/agents/postgres/pgstatstatements/utils.go +++ b/agent/agents/postgres/pgstatstatements/utils.go @@ -26,7 +26,7 @@ import ( "github.com/percona/pmm/agent/utils/truncate" ) -// statementsCache is a wrapper for cache.Cache to use only with statementsMap type +// statementsCache is a wrapper for cache.Cache to use only with statementsMap type. type statementsCache struct { cache *cache.Cache } diff --git a/agent/agents/process/process.go b/agent/agents/process/process.go index 7e81a6bc7a..3d47680094 100644 --- a/agent/agents/process/process.go +++ b/agent/agents/process/process.go @@ -106,8 +106,8 @@ func (p *Process) Run(ctx context.Context) { close(p.ctxDone) } -// STARTING -> RUNNING -// STARTING -> WAITING +// STARTING -> RUNNING. +// STARTING -> WAITING. func (p *Process) toStarting() { p.l.Tracef("Process: starting.") p.changes <- inventorypb.AgentStatus_STARTING @@ -149,8 +149,8 @@ func (p *Process) toStarting() { } } -// RUNNING -> STOPPING -// RUNNING -> WAITING +// RUNNING -> STOPPING. +// RUNNING -> WAITING. func (p *Process) toRunning() { p.l.Tracef("Process: running.") p.changes <- inventorypb.AgentStatus_RUNNING @@ -166,8 +166,8 @@ func (p *Process) toRunning() { } } -// WAITING -> STARTING -// WAITING -> DONE +// WAITING -> STARTING. +// WAITING -> DONE. func (p *Process) toWaiting() { delay := p.backoff.Delay() @@ -192,7 +192,7 @@ func (p *Process) toWaiting() { } } -// STOPPING -> DONE +// STOPPING -> DONE. func (p *Process) toStopping() { p.l.Tracef("Process: stopping (sending SIGTERM)...") p.changes <- inventorypb.AgentStatus_STOPPING @@ -235,7 +235,7 @@ func (p *Process) Logs() []string { return p.pl.Latest() } -// check interfaces +// check interfaces. var ( _ fmt.Stringer = (*Params)(nil) ) diff --git a/agent/agents/process/process_logger.go b/agent/agents/process/process_logger.go index 319bdf2ad5..048990c1d3 100644 --- a/agent/agents/process/process_logger.go +++ b/agent/agents/process/process_logger.go @@ -148,7 +148,7 @@ func extractLogLevel(line string) (logrus.Level, bool, error) { return level, true, nil } -// check interfaces +// check interfaces. var ( _ io.Writer = (*processLogger)(nil) ) diff --git a/agent/agents/supervisor/supervisor.go b/agent/agents/supervisor/supervisor.go index f33595efa6..2a481b9238 100644 --- a/agent/agents/supervisor/supervisor.go +++ b/agent/agents/supervisor/supervisor.go @@ -112,7 +112,7 @@ func NewSupervisor(ctx context.Context, av agentVersioner, cfg configGetter) *Su } } -// Run waits for context and stop all agents when it's done +// Run waits for context and stop all agents when it's done. func (s *Supervisor) Run(ctx context.Context) { <-ctx.Done() s.stopAll() //nolint:contextcheck @@ -188,7 +188,7 @@ func (s *Supervisor) AgentLogByID(id string) ([]string, uint) { return nil, 0 } -// ClearChangesChannel drains state change channel +// ClearChangesChannel drains state change channel. func (s *Supervisor) ClearChangesChannel() { for { select { @@ -618,7 +618,7 @@ func (s *Supervisor) startBuiltin(agentID string, builtinAgent *agentpb.SetState return nil } -// agentLogger write logs to Store so can get last N +// agentLogger write logs to Store so can get last N. func (s *Supervisor) agentLogger(logStore *tailog.Store) *logrus.Logger { return &logrus.Logger{ Out: io.MultiWriter(os.Stderr, logStore), @@ -768,7 +768,7 @@ func (s *Supervisor) Collect(ch chan<- prometheus.Metric) { } } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*Supervisor)(nil) ) diff --git a/agent/client/basic_auth.go b/agent/client/basic_auth.go index f525c8d723..ae38d59a5b 100644 --- a/agent/client/basic_auth.go +++ b/agent/client/basic_auth.go @@ -40,7 +40,7 @@ func (*basicAuth) RequireTransportSecurity() bool { return false } -// check interfaces +// check interfaces. var ( _ credentials.PerRPCCredentials = (*basicAuth)(nil) ) diff --git a/agent/client/channel/channel.go b/agent/client/channel/channel.go index a7313ea584..ce272b2e35 100644 --- a/agent/client/channel/channel.go +++ b/agent/client/channel/channel.go @@ -207,7 +207,7 @@ func (c *Channel) send(msg *agentpb.AgentMessage) { c.mSend.Inc() } -// runReader receives messages from server +// runReader receives messages from server. func (c *Channel) runReceiver() { defer func() { close(c.requests) @@ -384,7 +384,7 @@ func (c *Channel) Collect(ch chan<- prometheus.Metric) { c.mSend.Collect(ch) } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*Channel)(nil) ) diff --git a/agent/client/client.go b/agent/client/client.go index e4e3b6c5ed..c2106072d0 100644 --- a/agent/client/client.go +++ b/agent/client/client.go @@ -232,7 +232,7 @@ func (c *Client) Run(ctx context.Context) error { return nil } -// SendActualStatuses sends status of running agents to server +// SendActualStatuses sends status of running agents to server. func (c *Client) SendActualStatuses() { for _, agent := range c.supervisor.AgentsList() { c.l.Infof("Sending status: %s (port %d).", agent.Status, agent.ListenPort) @@ -878,7 +878,7 @@ func (c *Client) GetServerConnectMetadata() *agentpb.ServerConnectMetadata { return md } -// GetConnectionUpTime returns connection uptime between agent and server in percentage (from 0 to 100) +// GetConnectionUpTime returns connection uptime between agent and server in percentage (from 0 to 100). func (c *Client) GetConnectionUpTime() float32 { return c.cus.GetConnectedUpTimeUntil(time.Now()) } @@ -906,7 +906,7 @@ func (c *Client) Collect(ch chan<- prometheus.Metric) { c.supervisor.Collect(ch) } -// argListFromPgParams creates an array of strings from the pointer to the parameters for pt-pg-sumamry +// argListFromPgParams creates an array of strings from the pointer to the parameters for pt-pg-sumamry. func argListFromPgParams(pParams *agentpb.StartActionRequest_PTPgSummaryParams) []string { var args []string @@ -930,7 +930,7 @@ func argListFromPgParams(pParams *agentpb.StartActionRequest_PTPgSummaryParams) return args } -// argListFromMongoDBParams creates an array of strings from the pointer to the parameters for pt-mongodb-sumamry +// argListFromMongoDBParams creates an array of strings from the pointer to the parameters for pt-mongodb-sumamry. func argListFromMongoDBParams(pParams *agentpb.StartActionRequest_PTMongoDBSummaryParams) []string { var args []string @@ -972,7 +972,7 @@ func convertAgentErrorToGrpcStatus(agentErr error) *grpcstatus.Status { return status } -// check interface +// check interface. var ( _ prometheus.Collector = (*Client)(nil) ) diff --git a/agent/commands/clients.go b/agent/commands/clients.go index 32641052aa..fd45ebcb7e 100644 --- a/agent/commands/clients.go +++ b/agent/commands/clients.go @@ -206,7 +206,7 @@ func serverRegister(cfgSetup *config.Setup) (agentID, token string, _ error) { / return res.Payload.PMMAgent.AgentID, res.Payload.Token, nil } -// check interfaces +// check interfaces. var ( _ error = nginxError("") _ fmt.GoStringer = nginxError("") diff --git a/agent/config/logger.go b/agent/config/logger.go index 1daa9e513b..570ab0dbfa 100644 --- a/agent/config/logger.go +++ b/agent/config/logger.go @@ -32,7 +32,7 @@ func (v *gRPCLogger) V(l int) bool { return true } -// override InfoXXX methods with TraceXXX to keep gRPC and logrus levels in sync +// override InfoXXX methods with TraceXXX to keep gRPC and logrus levels in sync. func (v *gRPCLogger) Info(args ...interface{}) { v.Trace(args...) } func (v *gRPCLogger) Infoln(args ...interface{}) { v.Traceln(args...) } func (v *gRPCLogger) Infof(format string, args ...interface{}) { v.Tracef(format, args...) } diff --git a/agent/connectionuptime/service.go b/agent/connectionuptime/service.go index 49ec3bc0b0..5bac5c4555 100644 --- a/agent/connectionuptime/service.go +++ b/agent/connectionuptime/service.go @@ -26,7 +26,7 @@ import ( const periodForRunningDeletingOldEvents = time.Minute // Service calculates connection uptime between agent and server -// based on the connection events +// based on the connection events. type Service struct { mx sync.Mutex events []connectionEvent @@ -39,7 +39,7 @@ type connectionEvent struct { Connected bool } -// NewService creates new instance of Service +// NewService creates new instance of Service. func NewService(windowPeriod time.Duration) *Service { return &Service{ windowPeriod: windowPeriod, @@ -47,7 +47,7 @@ func NewService(windowPeriod time.Duration) *Service { } } -// SetWindowPeriod updates window period +// SetWindowPeriod updates window period. func (c *Service) SetWindowPeriod(windowPeriod time.Duration) { c.mx.Lock() defer c.mx.Unlock() @@ -55,7 +55,7 @@ func (c *Service) SetWindowPeriod(windowPeriod time.Duration) { c.windowPeriod = windowPeriod } -// RegisterConnectionStatus adds connection event +// RegisterConnectionStatus adds connection event. func (c *Service) RegisterConnectionStatus(timestamp time.Time, connected bool) { c.mx.Lock() defer c.mx.Unlock() diff --git a/agent/runner/actions/common.go b/agent/runner/actions/common.go index adff5d5bd0..44f8bb5151 100644 --- a/agent/runner/actions/common.go +++ b/agent/runner/actions/common.go @@ -40,7 +40,7 @@ var whiteSpacesRegExp = regexp.MustCompile(`\s+`) // ["value 1", 2, …] // … // -// ] +// ]. func jsonRows(columns []string, dataRows [][]interface{}) ([]byte, error) { res := make([][]interface{}, len(dataRows)+1) diff --git a/agent/runner/jobs/backup_location.go b/agent/runner/jobs/backup_location.go index 684525ae29..b77bf1e418 100644 --- a/agent/runner/jobs/backup_location.go +++ b/agent/runner/jobs/backup_location.go @@ -32,7 +32,7 @@ type S3LocationConfig struct { BucketRegion string } -// FilesystemBackupLocationConfig contains config for local storage +// FilesystemBackupLocationConfig contains config for local storage. type FilesystemBackupLocationConfig struct { Path string } diff --git a/agent/runner/jobs/mysql_restore_job.go b/agent/runner/jobs/mysql_restore_job.go index 761ce2ef5e..d5b528de22 100644 --- a/agent/runner/jobs/mysql_restore_job.go +++ b/agent/runner/jobs/mysql_restore_job.go @@ -38,7 +38,7 @@ const ( xbstreamBin = "xbstream" mySQLSystemUserName = "mysql" mySQLSystemGroupName = "mysql" - // TODO make mySQLDirectory autorecognized as done in 'xtrabackup' utility; see 'xtrabackup --help' --datadir parameter + // TODO make mySQLDirectory autorecognized as done in 'xtrabackup' utility; see 'xtrabackup --help' --datadir parameter. mySQLDirectory = "/var/lib/mysql" systemctlTimeout = 10 * time.Second ) @@ -428,7 +428,7 @@ func restoreBackup(ctx context.Context, backupDirectory, mySQLDirectory string) return nil } -// getMysqlServiceName returns MySQL system service name +// getMysqlServiceName returns MySQL system service name. func getMysqlServiceName(ctx context.Context) (string, error) { ctx, cancel := context.WithTimeout(ctx, systemctlTimeout) defer cancel() diff --git a/agent/runner/jobs/pbm_helpers.go b/agent/runner/jobs/pbm_helpers.go index c1afcd5505..b8f5777c8b 100644 --- a/agent/runner/jobs/pbm_helpers.go +++ b/agent/runner/jobs/pbm_helpers.go @@ -457,7 +457,7 @@ func writePBMConfigFile(conf *PBMConfig) (string, error) { return tmp.Name(), tmp.Close() } -// Serialization helpers +// Serialization helpers. // Storage represents target storage parameters. type Storage struct { diff --git a/agent/tailog/store.go b/agent/tailog/store.go index 45ff99c8d9..e558125f7a 100644 --- a/agent/tailog/store.go +++ b/agent/tailog/store.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package tailog helps store tail logs +// Package tailog helps store tail logs. package tailog import ( diff --git a/agent/utils/version/postgresql.go b/agent/utils/version/postgresql.go index a950a764eb..71f5d44eca 100644 --- a/agent/utils/version/postgresql.go +++ b/agent/utils/version/postgresql.go @@ -19,7 +19,7 @@ import ( "strings" ) -// regexps to extract version numbers from the `SELECT version()` output +// regexps to extract version numbers from the `SELECT version()` output. var ( postgresDBRegexp = regexp.MustCompile(`PostgreSQL ([\d\.]+)`) ) diff --git a/api-tests/helpers.go b/api-tests/helpers.go index 20d27307a6..1b280fd192 100644 --- a/api-tests/helpers.go +++ b/api-tests/helpers.go @@ -225,7 +225,7 @@ func AddPMMAgent(t TestingT, nodeID string) *agents.AddPMMAgentOKBody { return res.Payload } -// check interfaces +// check interfaces. var ( _ assert.TestingT = (*expectedFailureTestingT)(nil) _ require.TestingT = (*expectedFailureTestingT)(nil) diff --git a/api-tests/init.go b/api-tests/init.go index a750ed683f..d581c00fcb 100644 --- a/api-tests/init.go +++ b/api-tests/init.go @@ -235,7 +235,7 @@ func init() { } } -// check interfaces +// check interfaces. var ( _ error = (*NginxError)(nil) _ fmt.GoStringer = (*NginxError)(nil) diff --git a/api/agentpb/agent.go b/api/agentpb/agent.go index b866f40fe9..4b90297431 100644 --- a/api/agentpb/agent.go +++ b/api/agentpb/agent.go @@ -198,7 +198,7 @@ func (m *AgentLogsRequest) ServerMessageRequestPayload() isServerMessage_Payload return &ServerMessage_AgentLogs{AgentLogs: m} } -// in alphabetical order +// in alphabetical order. func (*ActionResultRequest) sealed() {} func (*ActionResultResponse) sealed() {} func (*CheckConnectionRequest) sealed() {} @@ -230,7 +230,7 @@ func (*GetVersionsResponse) sealed() {} func (*PBMSwitchPITRRequest) sealed() {} func (*PBMSwitchPITRResponse) sealed() {} -// check interfaces +// check interfaces. var ( // A list of AgentMessage request payloads. _ AgentRequestPayload = (*Ping)(nil) diff --git a/api/inventorypb/agents.go b/api/inventorypb/agents.go index 7d1f103dbb..8b919fe4eb 100644 --- a/api/inventorypb/agents.go +++ b/api/inventorypb/agents.go @@ -22,7 +22,7 @@ type Agent interface { sealedAgent() } -// Ordered the same as AgentType enum +// Ordered the same as AgentType enum. func (*PMMAgent) sealedAgent() {} func (*VMAgent) sealedAgent() {} diff --git a/api/inventorypb/agents_test.go b/api/inventorypb/agents_test.go index c331e999df..2926fb74ca 100644 --- a/api/inventorypb/agents_test.go +++ b/api/inventorypb/agents_test.go @@ -28,7 +28,7 @@ import ( // names is up to date with the types defined in AgentType_name by the proto definition // by calling the AgentTypeName function using the values from protobuf and it expects the // result is a non-empty string, meaning that the AgentTypeNames list matches the proto -// definitions +// definitions. func TestAgentTypes(t *testing.T) { for _, val := range AgentType_name { if strings.HasSuffix(val, "INVALID") { diff --git a/api/inventorypb/nodes.go b/api/inventorypb/nodes.go index e92d7876ac..5612d35323 100644 --- a/api/inventorypb/nodes.go +++ b/api/inventorypb/nodes.go @@ -22,7 +22,7 @@ type Node interface { sealedNode() } -// Ordered the same as NodeType enum +// Ordered the same as NodeType enum. func (*GenericNode) sealedNode() {} func (*ContainerNode) sealedNode() {} diff --git a/api/inventorypb/nodes_test.go b/api/inventorypb/nodes_test.go index b677e27239..f5e7399323 100644 --- a/api/inventorypb/nodes_test.go +++ b/api/inventorypb/nodes_test.go @@ -28,7 +28,7 @@ import ( // names is up to date with the types defined in Nodetype_name by the proto definition // by calling the NodetypeName function using the values from protobuf and it expects the // result is a non-empty string, meaning that the NodetypeNames list matches the proto -// definitions +// definitions. func TestNodeTypes(t *testing.T) { for _, val := range NodeType_name { if strings.HasSuffix(val, "INVALID") { diff --git a/api/inventorypb/services.go b/api/inventorypb/services.go index 2c2162b87c..f4aa147f43 100644 --- a/api/inventorypb/services.go +++ b/api/inventorypb/services.go @@ -22,7 +22,7 @@ type Service interface { sealedService() } -// Ordered the same as ServiceType enum +// Ordered the same as ServiceType enum. func (*MySQLService) sealedService() {} func (*MongoDBService) sealedService() {} diff --git a/api/inventorypb/services_test.go b/api/inventorypb/services_test.go index a9a63836af..dd2697d948 100644 --- a/api/inventorypb/services_test.go +++ b/api/inventorypb/services_test.go @@ -28,7 +28,7 @@ import ( // names is up to date with the types defined in ServiceType_name by the proto definition // by calling the ServiceTypeName function using the values from protobuf and it expects the // result is a non-empty string, meaning that the ServiceTypeNames list matches the proto -// definitions +// definitions. func TestServiceTypes(t *testing.T) { for _, val := range ServiceType_name { if strings.HasSuffix(val, "INVALID") { diff --git a/api/inventorypb/types/agent_types.go b/api/inventorypb/types/agent_types.go index 26a287e2b0..56817deb9a 100644 --- a/api/inventorypb/types/agent_types.go +++ b/api/inventorypb/types/agent_types.go @@ -18,7 +18,7 @@ package types import "fmt" -// this list should be in sync with inventorypb/agents.pb.go +// this list should be in sync with inventorypb/agents.pb.go. const ( AgentTypePMMAgent = "PMM_AGENT" AgentTypeVMAgent = "VM_AGENT" @@ -56,7 +56,7 @@ var agentTypeNames = map[string]string{ AgentTypeAzureDatabaseExporter: "azure_database_exporter", } -// AgentTypeName returns human friendly agent type to be used in reports +// AgentTypeName returns human friendly agent type to be used in reports. func AgentTypeName(t string) string { res := agentTypeNames[t] if res == "" { diff --git a/api/inventorypb/types/node_types.go b/api/inventorypb/types/node_types.go index b142edd1c8..e861436d5e 100644 --- a/api/inventorypb/types/node_types.go +++ b/api/inventorypb/types/node_types.go @@ -17,7 +17,7 @@ package types import "fmt" -// this list should be in sync with inventorypb/nodes.pb.go +// this list should be in sync with inventorypb/nodes.pb.go. const ( NodeTypeGenericNode = "GENERIC_NODE" NodeTypeContainerNode = "CONTAINER_NODE" @@ -35,7 +35,7 @@ var nodeTypeNames = map[string]string{ NodeTypeRemoteAzureDatabaseNode: "Remote Azure database", } -// NodeTypeName returns human friendly node type to be used in reports +// NodeTypeName returns human friendly node type to be used in reports. func NodeTypeName(t string) string { res := nodeTypeNames[t] if res == "" { diff --git a/api/inventorypb/types/service_types.go b/api/inventorypb/types/service_types.go index ab3ede1977..a1b24ba061 100644 --- a/api/inventorypb/types/service_types.go +++ b/api/inventorypb/types/service_types.go @@ -17,7 +17,7 @@ package types import "fmt" -// this list should be in sync with inventorypb/services.pb.go +// this list should be in sync with inventorypb/services.pb.go. const ( ServiceTypeMySQLService = "MYSQL_SERVICE" ServiceTypeMongoDBService = "MONGODB_SERVICE" @@ -37,7 +37,7 @@ var serviceTypeNames = map[string]string{ ServiceTypeExternalService: "External", } -// ServiceTypeName returns human friendly service type to be used in reports +// ServiceTypeName returns human friendly service type to be used in reports. func ServiceTypeName(t string) string { res := serviceTypeNames[t] if res == "" { diff --git a/api/managementpb/checks.pb.go b/api/managementpb/checks.pb.go index ead9da805a..b86b939868 100644 --- a/api/managementpb/checks.pb.go +++ b/api/managementpb/checks.pb.go @@ -1654,7 +1654,7 @@ var file_managementpb_checks_proto_rawDesc = []byte{ 0x41, 0x4d, 0x49, 0x4c, 0x59, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x47, 0x52, 0x45, 0x53, 0x51, 0x4c, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x44, 0x56, 0x49, 0x53, 0x4f, 0x52, 0x5f, 0x43, 0x48, 0x45, 0x43, 0x4b, 0x5f, 0x46, 0x41, 0x4d, 0x49, 0x4c, 0x59, 0x5f, 0x4d, 0x4f, 0x4e, 0x47, 0x4f, - 0x44, 0x42, 0x10, 0x03, 0x32, 0xe8, 0x0f, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, + 0x44, 0x42, 0x10, 0x03, 0x32, 0xef, 0x0f, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x89, 0x02, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, @@ -1686,111 +1686,111 @@ var file_managementpb_checks_proto_rawDesc = []byte{ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x3a, 0x01, 0x2a, 0x22, 0x2a, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0xe7, 0x01, 0x0a, 0x10, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0xec, 0x01, 0x0a, 0x10, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, 0x23, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x87, 0x01, 0x92, 0x41, 0x4b, 0x12, 0x12, 0x54, 0x6f, 0x67, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8c, 0x01, 0x92, 0x41, 0x4d, 0x12, 0x12, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x1a, 0x35, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x55, 0x6e, 0x73, 0x69, 0x6c, 0x65, 0x6e, 0x63, 0x65, 0x20, 0x61, 0x6c, 0x65, 0x72, 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x3a, 0x01, 0x2a, 0x22, - 0x2e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x54, - 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, 0x74, 0x12, - 0x86, 0x02, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2a, 0x2e, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x75, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x2e, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x33, 0x3a, 0x01, + 0x2a, 0x22, 0x2e, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x2f, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x6c, 0x65, 0x72, + 0x74, 0x88, 0x02, 0x01, 0x12, 0x88, 0x02, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x91, 0x01, 0x92, 0x41, 0x53, 0x12, 0x1a, 0x47, 0x65, 0x74, 0x20, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x35, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, - 0x54, 0x6f, 0x6f, 0x6c, 0x27, 0x73, 0x20, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x20, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x32, 0x3a, 0x01, 0x2a, 0x22, 0x2d, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x47, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x73, 0x88, 0x02, 0x01, 0x12, 0xc9, 0x02, 0x0a, 0x13, 0x53, 0x74, 0x61, + 0x12, 0x2a, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, + 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x93, 0x01, 0x92, 0x41, 0x55, 0x12, + 0x1a, 0x47, 0x65, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x20, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x1a, 0x35, 0x52, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x73, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x54, 0x68, + 0x72, 0x65, 0x61, 0x64, 0x20, 0x54, 0x6f, 0x6f, 0x6c, 0x27, 0x73, 0x20, 0x6c, 0x61, 0x74, 0x65, + 0x73, 0x74, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, + 0x73, 0x2e, 0x58, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x3a, 0x01, 0x2a, 0x22, 0x2d, 0x2f, + 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, 0x65, + 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x47, 0x65, 0x74, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x88, 0x02, 0x01, 0x12, + 0xc9, 0x02, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, + 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x26, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, + 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x27, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x12, 0x26, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, - 0x61, 0x72, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0xe0, 0x01, 0x92, 0x41, 0xae, 0x01, 0x12, 0x15, 0x53, 0x74, 0x61, 0x72, 0x74, 0x20, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x1a, - 0x94, 0x01, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x73, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, - 0x69, 0x74, 0x79, 0x20, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, 0x54, 0x6f, 0x6f, 0x6c, 0x20, - 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, - 0x6e, 0x73, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x63, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x2e, - 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x77, 0x69, 0x6c, 0x6c, 0x20, 0x62, 0x65, 0x20, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x65, 0x64, 0x20, 0x69, 0x66, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x6e, 0x27, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x3a, 0x01, 0x2a, 0x22, - 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x12, 0xdb, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x63, - 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe0, 0x01, 0x92, 0x41, 0xae, 0x01, 0x12, + 0x15, 0x53, 0x74, 0x61, 0x72, 0x74, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x1a, 0x94, 0x01, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, + 0x73, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x54, 0x68, 0x72, 0x65, 0x61, + 0x64, 0x20, 0x54, 0x6f, 0x6f, 0x6c, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x61, 0x6e, + 0x64, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x61, + 0x6c, 0x6c, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x65, 0x78, + 0x65, 0x63, 0x75, 0x74, 0x65, 0x64, 0x2e, 0x20, 0x41, 0x6c, 0x6c, 0x20, 0x61, 0x76, 0x61, 0x69, + 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x77, 0x69, 0x6c, + 0x6c, 0x20, 0x62, 0x65, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x20, 0x69, 0x66, 0x20, + 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x6e, + 0x27, 0x74, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2e, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x28, 0x3a, 0x01, 0x2a, 0x22, 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0xdb, 0x01, 0x0a, 0x12, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x76, 0x92, 0x41, 0x46, 0x12, - 0x13, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x20, 0x63, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x1a, 0x2f, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, - 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x61, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, - 0x75, 0x73, 0x65, 0x72, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, - 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0xbf, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x76, 0x69, 0x73, - 0x6f, 0x72, 0x73, 0x12, 0x1f, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6c, 0x92, 0x41, 0x42, 0x12, 0x0d, 0x4c, 0x69, 0x73, - 0x74, 0x20, 0x61, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x1a, 0x31, 0x52, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x64, - 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, - 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x41, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x2f, - 0x4c, 0x69, 0x73, 0x74, 0x12, 0x88, 0x02, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x12, 0x27, 0x2e, + 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x63, 0x75, 0x72, + 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x76, 0x92, 0x41, 0x46, 0x12, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x64, 0x76, + 0x69, 0x73, 0x6f, 0x72, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x1a, 0x2f, 0x52, 0x65, 0x74, + 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x63, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, + 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x27, 0x3a, 0x01, 0x2a, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0xbf, 0x01, 0x0a, 0x0c, 0x4c, 0x69, + 0x73, 0x74, 0x41, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x12, 0x1f, 0x2e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x76, 0x69, + 0x73, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x64, 0x76, + 0x69, 0x73, 0x6f, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6c, 0x92, + 0x41, 0x42, 0x12, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, + 0x73, 0x1a, 0x31, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x61, 0x20, 0x6c, 0x69, 0x73, + 0x74, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x64, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x20, 0x61, 0x76, + 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x01, 0x2a, 0x22, 0x1c, 0x2f, + 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x41, 0x64, + 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x88, 0x02, 0x0a, 0x14, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x12, 0x27, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x9c, 0x01, 0x92, 0x41, 0x6a, 0x12, 0x16, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x53, - 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x1a, 0x50, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x2f, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x73, - 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, - 0x20, 0x54, 0x6f, 0x6f, 0x6c, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x20, 0x6f, 0x72, 0x20, - 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x69, 0x72, 0x20, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x20, 0x62, 0x79, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x6d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, - 0x8e, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x42, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x65, - 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, 0x62, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, - 0xaa, 0x02, 0x0a, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0xca, 0x02, 0x0a, - 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0xe2, 0x02, 0x16, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9c, 0x01, 0x92, 0x41, 0x6a, 0x12, 0x16, 0x43, + 0x68, 0x61, 0x6e, 0x67, 0x65, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x1a, 0x50, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x2f, 0x64, + 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, + 0x20, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x20, 0x54, 0x6f, 0x6f, 0x6c, 0x20, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x73, 0x20, 0x6f, 0x72, 0x20, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x20, 0x74, + 0x68, 0x65, 0x69, 0x72, 0x20, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x20, 0x62, 0x79, + 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, + 0x22, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x2f, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x2f, + 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x42, 0x8e, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, + 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x61, 0x2f, 0x70, 0x6d, 0x6d, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x70, + 0x62, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0a, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0xca, 0x02, 0x0a, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0xe2, 0x02, 0x16, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x4d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/managementpb/checks.proto b/api/managementpb/checks.proto index 91bf8e0743..e2d9f82add 100644 --- a/api/managementpb/checks.proto +++ b/api/managementpb/checks.proto @@ -204,6 +204,7 @@ service SecurityChecks { } // ToggleCheckAlert allows to switch alerts state for a check result between "silenced" and "unsilenced". rpc ToggleCheckAlert(ToggleCheckAlertRequest) returns (ToggleCheckAlertResponse) { + option deprecated = true; option (google.api.http) = { post: "/v1/management/SecurityChecks/ToggleCheckAlert" body: "*" @@ -211,6 +212,7 @@ service SecurityChecks { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Toggle Check Alert" description: "Silence/Unsilence alerts for a specific check result." + deprecated: true }; } // GetSecurityCheckResults returns Security Thread Tool's latest checks results. @@ -223,6 +225,7 @@ service SecurityChecks { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Get Security Check Results" description: "Returns Security Thread Tool's latest checks results." + deprecated: true }; } // StartSecurityChecks executes Security Thread Tool checks and returns when all checks are executed. diff --git a/api/managementpb/checks_grpc.pb.go b/api/managementpb/checks_grpc.pb.go index bfa8496cd4..0408efe0a2 100644 --- a/api/managementpb/checks_grpc.pb.go +++ b/api/managementpb/checks_grpc.pb.go @@ -38,6 +38,7 @@ type SecurityChecksClient interface { ListFailedServices(ctx context.Context, in *ListFailedServicesRequest, opts ...grpc.CallOption) (*ListFailedServicesResponse, error) // GetFailedChecks returns the checks result for a given service. GetFailedChecks(ctx context.Context, in *GetFailedChecksRequest, opts ...grpc.CallOption) (*GetFailedChecksResponse, error) + // Deprecated: Do not use. // ToggleCheckAlert allows to switch alerts state for a check result between "silenced" and "unsilenced". ToggleCheckAlert(ctx context.Context, in *ToggleCheckAlertRequest, opts ...grpc.CallOption) (*ToggleCheckAlertResponse, error) // Deprecated: Do not use. @@ -79,6 +80,7 @@ func (c *securityChecksClient) GetFailedChecks(ctx context.Context, in *GetFaile return out, nil } +// Deprecated: Do not use. func (c *securityChecksClient) ToggleCheckAlert(ctx context.Context, in *ToggleCheckAlertRequest, opts ...grpc.CallOption) (*ToggleCheckAlertResponse, error) { out := new(ToggleCheckAlertResponse) err := c.cc.Invoke(ctx, SecurityChecks_ToggleCheckAlert_FullMethodName, in, out, opts...) @@ -142,6 +144,7 @@ type SecurityChecksServer interface { ListFailedServices(context.Context, *ListFailedServicesRequest) (*ListFailedServicesResponse, error) // GetFailedChecks returns the checks result for a given service. GetFailedChecks(context.Context, *GetFailedChecksRequest) (*GetFailedChecksResponse, error) + // Deprecated: Do not use. // ToggleCheckAlert allows to switch alerts state for a check result between "silenced" and "unsilenced". ToggleCheckAlert(context.Context, *ToggleCheckAlertRequest) (*ToggleCheckAlertResponse, error) // Deprecated: Do not use. diff --git a/api/managementpb/json/managementpb.json b/api/managementpb/json/managementpb.json index 906290de9f..b5c9de7585 100644 --- a/api/managementpb/json/managementpb.json +++ b/api/managementpb/json/managementpb.json @@ -6365,6 +6365,7 @@ ], "summary": "Get Security Check Results", "operationId": "GetSecurityCheckResults", + "deprecated": true, "parameters": [ { "name": "body", @@ -6788,6 +6789,7 @@ ], "summary": "Toggle Check Alert", "operationId": "ToggleCheckAlert", + "deprecated": true, "parameters": [ { "name": "body", diff --git a/api/swagger/swagger-dev.json b/api/swagger/swagger-dev.json index bd44fe8f09..8801f4cba5 100644 --- a/api/swagger/swagger-dev.json +++ b/api/swagger/swagger-dev.json @@ -29902,6 +29902,7 @@ ], "summary": "Get Security Check Results", "operationId": "GetSecurityCheckResults", + "deprecated": true, "parameters": [ { "name": "body", @@ -30325,6 +30326,7 @@ ], "summary": "Toggle Check Alert", "operationId": "ToggleCheckAlert", + "deprecated": true, "parameters": [ { "name": "body", diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index 48d466adff..f1e0ccb21b 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -20529,6 +20529,7 @@ ], "summary": "Get Security Check Results", "operationId": "GetSecurityCheckResults", + "deprecated": true, "parameters": [ { "name": "body", @@ -20952,6 +20953,7 @@ ], "summary": "Toggle Check Alert", "operationId": "ToggleCheckAlert", + "deprecated": true, "parameters": [ { "name": "body", diff --git a/build/packages/rpm/server/SPECS/victoriametrics.spec b/build/packages/rpm/server/SPECS/victoriametrics.spec index 52e849a091..831feb7138 100644 --- a/build/packages/rpm/server/SPECS/victoriametrics.spec +++ b/build/packages/rpm/server/SPECS/victoriametrics.spec @@ -9,11 +9,11 @@ %global repo VictoriaMetrics %global provider github.com/VictoriaMetrics/%{repo} -%global commit pmm-6401-v1.89.1 +%global commit pmm-6401-v1.93.1 Name: percona-victoriametrics -Version: 1.89.1 -Release: 1%{?dist} +Version: 1.93.1 +Release: 2%{?dist} Summary: VictoriaMetrics monitoring solution and time series database License: Apache-2.0 URL: https://%{provider} @@ -50,6 +50,9 @@ install -D -p -m 0755 ./bin/vmalert-pure %{buildroot}%{_sbindir}/vmalert %changelog +* Fri Sep 1 2023 Nurlan Moldomurov - 1.93.1-2 +- upgrade victoriametrics to 1.93.1 release + * Thu Mar 29 2023 Alexey Mukas - 1.89.1 - upgrade victoriametrics to 1.89.1 release diff --git a/build/scripts/vars b/build/scripts/vars index bd267aa95e..f1597dd14a 100644 --- a/build/scripts/vars +++ b/build/scripts/vars @@ -55,5 +55,5 @@ docker_client_tarball=${root_dir}/results/docker/pmm2-client-${pmm_version}.dock source_tarball=${root_dir}/results/source_tarball/pmm2-client-${pmm_version}.tar.gz binary_tarball=${root_dir}/results/tarball/pmm2-client-${pmm_version}.tar.gz -# https://github.com/VictoriaMetrics/VictoriaMetrics/tree/pmm-6401-v1.89.1 -vmagent_commit_hash=88b4c30021ea0785bd052de537252a5cb9a8da3e +# https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/pmm-6401-v1.93.1 +vmagent_commit_hash=ca20478a69233179b1891755937b5c7d58791fc2 diff --git a/cli-tests/package-lock.json b/cli-tests/package-lock.json index f182e3dba8..99f50ea24c 100644 --- a/cli-tests/package-lock.json +++ b/cli-tests/package-lock.json @@ -20,8 +20,8 @@ "devDependencies": { "@types/promise-retry": "^1.1.3", "@types/shelljs": "^0.8.12", - "@typescript-eslint/eslint-plugin": "^6.4.0", - "@typescript-eslint/parser": "^6.4.0", + "@typescript-eslint/eslint-plugin": "^6.6.0", + "@typescript-eslint/parser": "^6.6.0", "eslint": "8.47", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-typescript": "^17.1.0", @@ -245,9 +245,9 @@ "dev": true }, "node_modules/@types/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==", "dev": true }, "node_modules/@types/shelljs": { @@ -261,16 +261,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.4.0.tgz", - "integrity": "sha512-62o2Hmc7Gs3p8SLfbXcipjWAa6qk2wZGChXG2JbBtYpwSRmti/9KHLqfbLs9uDigOexG+3PaQ9G2g3201FWLKg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.6.0.tgz", + "integrity": "sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.4.0", - "@typescript-eslint/type-utils": "6.4.0", - "@typescript-eslint/utils": "6.4.0", - "@typescript-eslint/visitor-keys": "6.4.0", + "@typescript-eslint/scope-manager": "6.6.0", + "@typescript-eslint/type-utils": "6.6.0", + "@typescript-eslint/utils": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -296,15 +296,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.4.0.tgz", - "integrity": "sha512-I1Ah1irl033uxjxO9Xql7+biL3YD7w9IU8zF+xlzD/YxY6a4b7DYA08PXUUCbm2sEljwJF6ERFy2kTGAGcNilg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.6.0.tgz", + "integrity": "sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.4.0", - "@typescript-eslint/types": "6.4.0", - "@typescript-eslint/typescript-estree": "6.4.0", - "@typescript-eslint/visitor-keys": "6.4.0", + "@typescript-eslint/scope-manager": "6.6.0", + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/typescript-estree": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0", "debug": "^4.3.4" }, "engines": { @@ -324,13 +324,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.4.0.tgz", - "integrity": "sha512-TUS7vaKkPWDVvl7GDNHFQMsMruD+zhkd3SdVW0d7b+7Zo+bd/hXJQ8nsiUZMi1jloWo6c9qt3B7Sqo+flC1nig==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz", + "integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.4.0", - "@typescript-eslint/visitor-keys": "6.4.0" + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -341,13 +341,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.4.0.tgz", - "integrity": "sha512-TvqrUFFyGY0cX3WgDHcdl2/mMCWCDv/0thTtx/ODMY1QhEiyFtv/OlLaNIiYLwRpAxAtOLOY9SUf1H3Q3dlwAg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.6.0.tgz", + "integrity": "sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.4.0", - "@typescript-eslint/utils": "6.4.0", + "@typescript-eslint/typescript-estree": "6.6.0", + "@typescript-eslint/utils": "6.6.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -368,9 +368,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.4.0.tgz", - "integrity": "sha512-+FV9kVFrS7w78YtzkIsNSoYsnOtrYVnKWSTVXoL1761CsCRv5wpDOINgsXpxD67YCLZtVQekDDyaxfjVWUJmmg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz", + "integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -381,13 +381,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.4.0.tgz", - "integrity": "sha512-iDPJArf/K2sxvjOR6skeUCNgHR/tCQXBsa+ee1/clRKr3olZjZ/dSkXPZjG6YkPtnW6p5D1egeEPMCW6Gn4yLA==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz", + "integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.4.0", - "@typescript-eslint/visitor-keys": "6.4.0", + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -408,17 +408,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.4.0.tgz", - "integrity": "sha512-BvvwryBQpECPGo8PwF/y/q+yacg8Hn/2XS+DqL/oRsOPK+RPt29h5Ui5dqOKHDlbXrAeHUTnyG3wZA0KTDxRZw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.6.0.tgz", + "integrity": "sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.4.0", - "@typescript-eslint/types": "6.4.0", - "@typescript-eslint/typescript-estree": "6.4.0", + "@typescript-eslint/scope-manager": "6.6.0", + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/typescript-estree": "6.6.0", "semver": "^7.5.4" }, "engines": { @@ -433,12 +433,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.4.0.tgz", - "integrity": "sha512-yJSfyT+uJm+JRDWYRYdCm2i+pmvXJSMtPR9Cq5/XQs4QIgNoLcoRtDdzsLbLsFM/c6um6ohQkg/MLxWvoIndJA==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz", + "integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.4.0", + "@typescript-eslint/types": "6.6.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { diff --git a/cli-tests/package.json b/cli-tests/package.json index c9e74264ce..8ac4a556cf 100644 --- a/cli-tests/package.json +++ b/cli-tests/package.json @@ -24,8 +24,8 @@ "devDependencies": { "@types/promise-retry": "^1.1.3", "@types/shelljs": "^0.8.12", - "@typescript-eslint/eslint-plugin": "^6.4.0", - "@typescript-eslint/parser": "^6.4.0", + "@typescript-eslint/eslint-plugin": "^6.6.0", + "@typescript-eslint/parser": "^6.6.0", "eslint": "8.47", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-typescript": "^17.1.0", diff --git a/go.mod b/go.mod index 21ac12e230..b5b9738aea 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/alecthomas/kong v0.8.0 github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 - github.com/aws/aws-sdk-go v1.44.317 + github.com/aws/aws-sdk-go v1.45.2 github.com/blang/semver v3.5.1+incompatible github.com/brianvoe/gofakeit/v6 v6.23.0 github.com/charmbracelet/bubbles v0.15.0 @@ -76,8 +76,8 @@ require ( go.starlark.net v0.0.0-20230717150657-8a3343210976 golang.org/x/crypto v0.12.0 golang.org/x/sync v0.3.0 - golang.org/x/sys v0.11.0 - golang.org/x/text v0.12.0 + golang.org/x/sys v0.12.0 + golang.org/x/text v0.13.0 golang.org/x/tools v0.12.0 google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d diff --git a/go.sum b/go.sum index 24fc2ef5b6..93a0e9d0d8 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,8 @@ github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.40.7/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= -github.com/aws/aws-sdk-go v1.44.317 h1:+8XWrLmGMwPPXSRSLPzhgcGnzJ2mYkgkrcB9C/GnSOU= -github.com/aws/aws-sdk-go v1.44.317/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.45.2 h1:hTong9YUklQKqzrGk3WnKABReb5R8GjbG4Y6dEQfjnk= +github.com/aws/aws-sdk-go v1.45.2/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= @@ -982,8 +982,8 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1002,8 +1002,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/managed/cmd/pmm-managed-starlark/main.go b/managed/cmd/pmm-managed-starlark/main.go index bf55e01577..8247879f6d 100644 --- a/managed/cmd/pmm-managed-starlark/main.go +++ b/managed/cmd/pmm-managed-starlark/main.go @@ -129,13 +129,13 @@ func runChecks(l *logrus.Entry, data *checks.StarlarkScriptData) ([]check.Result if !ok { return nil, errors.Errorf("unexpected query result type: %T", dbQr) } - if dbRes[dbName], err = unmarshallQueryResult(s); err != nil { + if dbRes[dbName], err = unmarshalQueryResult(s); err != nil { return nil, err } } res[i] = dbRes case string: // used for all other databases - if res[i], err = unmarshallQueryResult(qr); err != nil { + if res[i], err = unmarshalQueryResult(qr); err != nil { return nil, err } default: @@ -158,7 +158,7 @@ func runChecks(l *logrus.Entry, data *checks.StarlarkScriptData) ([]check.Result return results, nil } -func unmarshallQueryResult(qr string) ([]map[string]any, error) { +func unmarshalQueryResult(qr string) ([]map[string]any, error) { b, err := base64.StdEncoding.DecodeString(qr) if err != nil { return nil, errors.Wrap(err, "failed to decode base64 encoded query result") diff --git a/managed/cmd/pmm-managed-starlark/main_test.go b/managed/cmd/pmm-managed-starlark/main_test.go index 1eaa23d17b..e7a03037e1 100644 --- a/managed/cmd/pmm-managed-starlark/main_test.go +++ b/managed/cmd/pmm-managed-starlark/main_test.go @@ -37,7 +37,7 @@ const ( // Possible errors: // fatal error: runtime: out of memory - // fatal error: out of memory allocating heap arena metadata + // fatal error: out of memory allocating heap arena metadatai. memoryConsumingScriptStderr = "out of memory" ) diff --git a/managed/cmd/pmm-managed/main.go b/managed/cmd/pmm-managed/main.go index bc15c61f60..a27c774228 100644 --- a/managed/cmd/pmm-managed/main.go +++ b/managed/cmd/pmm-managed/main.go @@ -912,8 +912,7 @@ func main() { //nolint:cyclop,maintidx l.Fatalf("Could not create Clickhouse client: %s", err) } - checksService := checks.New(db, platformClient, actionsService, alertManager, v1.NewAPI(vmClient), clickhouseClient) - + checksService := checks.New(db, platformClient, actionsService, v1.NewAPI(vmClient), clickhouseClient) prom.MustRegister(checksService) // Integrated alerts services diff --git a/managed/models/action_models.go b/managed/models/action_models.go index e6bc10876c..eee93990d2 100644 --- a/managed/models/action_models.go +++ b/managed/models/action_models.go @@ -57,7 +57,7 @@ func (s *ActionResult) AfterFind() error { return nil } -// check interfaces +// check interfaces. var ( _ reform.BeforeInserter = (*ActionResult)(nil) _ reform.BeforeUpdater = (*ActionResult)(nil) diff --git a/managed/models/database_test.go b/managed/models/database_test.go index 083ab679a6..f58cd39e1d 100644 --- a/managed/models/database_test.go +++ b/managed/models/database_test.go @@ -32,7 +32,7 @@ import ( "github.com/percona/pmm/managed/utils/testdb" ) -// See https://www.postgresql.org/docs/10/errcodes-appendix.html for error codes +// See https://www.postgresql.org/docs/10/errcodes-appendix.html for error codes. func assertUniqueViolation(t *testing.T, err error, constraint string) { t.Helper() diff --git a/managed/models/kubernetes_helpers.go b/managed/models/kubernetes_helpers.go index 7c2a2d9447..fad875311d 100644 --- a/managed/models/kubernetes_helpers.go +++ b/managed/models/kubernetes_helpers.go @@ -117,7 +117,7 @@ func CreateKubernetesCluster(q *reform.Querier, params *CreateKubernetesClusterP return row, nil } -// ChangeKubernetesClusterToReady changes k8s cluster to ready state once provisioning is finished +// ChangeKubernetesClusterToReady changes k8s cluster to ready state once provisioning is finished. func ChangeKubernetesClusterToReady(q *reform.Querier, name string) error { c, err := FindKubernetesClusterByName(q, name) if err != nil { diff --git a/managed/models/kubernetes_models.go b/managed/models/kubernetes_models.go index 1fa98726f4..55e875265e 100644 --- a/managed/models/kubernetes_models.go +++ b/managed/models/kubernetes_models.go @@ -24,7 +24,7 @@ import ( //go:generate ../../bin/reform -// Component stores info about DBaaS Component +// Component stores info about DBaaS Component. type Component struct { DisabledVersions []string DefaultVersion string diff --git a/managed/models/location_model.go b/managed/models/location_model.go index ddde641b1b..9cb2246acb 100644 --- a/managed/models/location_model.go +++ b/managed/models/location_model.go @@ -27,7 +27,7 @@ import ( // BackupLocationType represents BackupLocation type as stored in database. type BackupLocationType string -// BackupLocation types. Same as in agent/runner/jobs/backup_location.go +// BackupLocation types. Same as in agent/runner/jobs/backup_location.go. const ( S3BackupLocationType BackupLocationType = "s3" FilesystemBackupLocationType BackupLocationType = "filesystem" diff --git a/managed/models/node_model.go b/managed/models/node_model.go index c6ebdf104a..07587fb50e 100644 --- a/managed/models/node_model.go +++ b/managed/models/node_model.go @@ -134,7 +134,7 @@ func (s *Node) UnifiedLabels() (map[string]string, error) { return res, nil } -// check interfaces +// check interfaces. var ( _ reform.BeforeInserter = (*Node)(nil) _ reform.BeforeUpdater = (*Node)(nil) diff --git a/managed/models/postgresql_version.go b/managed/models/postgresql_version.go index a5e6cb53eb..2a5cba30e9 100644 --- a/managed/models/postgresql_version.go +++ b/managed/models/postgresql_version.go @@ -24,7 +24,7 @@ import ( "gopkg.in/reform.v1" ) -// regexps to extract version numbers from the `SELECT version()` output +// regexps to extract version numbers from the `SELECT version()` output. var ( postgresDBRegexp = regexp.MustCompile(`PostgreSQL (\d+\.?\d+)`) ) diff --git a/managed/models/service_model.go b/managed/models/service_model.go index fe3c3cc145..721e59ed64 100644 --- a/managed/models/service_model.go +++ b/managed/models/service_model.go @@ -132,7 +132,7 @@ func (s *Service) UnifiedLabels() (map[string]string, error) { return res, nil } -// check interfaces +// check interfaces. var ( _ reform.BeforeInserter = (*Service)(nil) _ reform.BeforeUpdater = (*Service)(nil) diff --git a/managed/services/checks/checks.go b/managed/services/checks/checks.go index 1d14bedb8b..f0c4c34360 100644 --- a/managed/services/checks/checks.go +++ b/managed/services/checks/checks.go @@ -33,7 +33,6 @@ import ( "time" "github.com/percona-platform/saas/pkg/check" - "github.com/percona-platform/saas/pkg/common" "github.com/pkg/errors" v1 "github.com/prometheus/client_golang/api/prometheus/v1" prom "github.com/prometheus/client_golang/prometheus" @@ -58,7 +57,6 @@ const ( // Environment variables that affect checks service; only for testing. envCheckFile = "PERCONA_TEST_CHECKS_FILE" - envResendInterval = "PERCONA_TEST_CHECKS_RESEND_INTERVAL" envDisableStartDelay = "PERCONA_TEST_CHECKS_DISABLE_START_DELAY" checkExecutionTimeout = 5 * time.Minute // limits execution time for every single check @@ -67,14 +65,9 @@ const ( scriptExecutionTimeout = 5 * time.Second // time limit for running pmm-managed-starlark resultCheckInterval = time.Second - // Sync with API tests. - resolveTimeoutFactor = 3 - defaultResendInterval = 2 * time.Second - prometheusNamespace = "pmm_managed" prometheusSubsystem = "advisor" - alertsPrefix = "/stt/" maxSupportedVersion = 2 ) @@ -91,17 +84,15 @@ var ( // Service is responsible for interactions with Percona Check service. type Service struct { - platformClient *platform.Client - agentsRegistry agentsRegistry - alertmanagerService alertmanagerService - db *reform.DB - alertsRegistry *registry - vmClient v1.API - clickhouseDB *sql.DB + platformClient *platform.Client + agentsRegistry agentsRegistry + db *reform.DB + alertsRegistry *registry + vmClient v1.API + clickhouseDB *sql.DB l *logrus.Entry startDelay time.Duration - resendInterval time.Duration platformPublicKeys []string localChecksFile string // For testing @@ -131,18 +122,11 @@ func New( db *reform.DB, platformClient *platform.Client, agentsRegistry agentsRegistry, - alertmanagerService alertmanagerService, vmClient v1.API, clickhouseDB *sql.DB, ) *Service { l := logrus.WithField("component", "checks") - resendInterval := defaultResendInterval - if d, err := time.ParseDuration(os.Getenv(envResendInterval)); err == nil && d > 0 { - l.Warnf("Interval changed to %s.", d) - resendInterval = d - } - var platformPublicKeys []string if k := envvars.GetPlatformPublicKeys(); k != nil { l.Warnf("Percona Platform public keys changed to %q.", k) @@ -150,17 +134,15 @@ func New( } s := &Service{ - db: db, - agentsRegistry: agentsRegistry, - alertmanagerService: alertmanagerService, - alertsRegistry: newRegistry(resolveTimeoutFactor * resendInterval), - vmClient: vmClient, - clickhouseDB: clickhouseDB, + db: db, + agentsRegistry: agentsRegistry, + alertsRegistry: newRegistry(), + vmClient: vmClient, + clickhouseDB: clickhouseDB, l: l, platformClient: platformClient, startDelay: defaultStartDelay, - resendInterval: resendInterval, platformPublicKeys: platformPublicKeys, localChecksFile: os.Getenv(envCheckFile), @@ -226,12 +208,6 @@ func (s *Service) Run(ctx context.Context) { var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - s.resendAlerts(ctx) - }() - wg.Add(1) go func() { defer wg.Done() @@ -241,23 +217,6 @@ func (s *Service) Run(ctx context.Context) { wg.Wait() } -// resendAlerts resends collected alerts until ctx is canceled. -func (s *Service) resendAlerts(ctx context.Context) { - t := time.NewTicker(s.resendInterval) - defer t.Stop() - - for { - s.alertmanagerService.SendAlerts(ctx, s.alertsRegistry.collect()) - - select { - case <-ctx.Done(): - return - case <-t.C: - // nothing, continue for loop - } - } -} - // runChecksLoop starts checks execution loop. func (s *Service) runChecksLoop(ctx context.Context) { // First checks run, start all checks from all groups. @@ -298,11 +257,11 @@ func (s *Service) GetSecurityCheckResults() ([]services.CheckResult, error) { return nil, services.ErrAdvisorsDisabled } - return s.alertsRegistry.getCheckResults(), nil + return s.alertsRegistry.getCheckResults(""), nil } // GetChecksResults returns the failed checks for a given service from AlertManager. -func (s *Service) GetChecksResults(ctx context.Context, serviceID string) ([]services.CheckResult, error) { +func (s *Service) GetChecksResults(_ context.Context, serviceID string) ([]services.CheckResult, error) { settings, err := models.GetSettings(s.db) if err != nil { return nil, err @@ -312,59 +271,7 @@ func (s *Service) GetChecksResults(ctx context.Context, serviceID string) ([]ser return nil, services.ErrAdvisorsDisabled } - filters := &services.FilterParams{ - IsCheck: true, - ServiceID: serviceID, - } - res, err := s.alertmanagerService.GetAlerts(ctx, filters) - if err != nil { - return nil, err - } - - checkResults := make([]services.CheckResult, 0, len(res)) - for _, alert := range res { - checkResults = append(checkResults, services.CheckResult{ - CheckName: alert.Labels[model.AlertNameLabel], - Silenced: len(alert.Status.SilencedBy) != 0, - AlertID: alert.Labels["alert_id"], - Interval: check.Interval(alert.Labels["interval_group"]), - Target: services.Target{ - AgentID: alert.Labels["agent_id"], - ServiceID: alert.Labels["service_id"], - ServiceName: alert.Labels["service_name"], - NodeName: alert.Labels["node_name"], - Labels: alert.Labels, - }, - Result: check.Result{ - Summary: alert.Annotations["summary"], - Description: alert.Annotations["description"], - ReadMoreURL: alert.Annotations["read_more_url"], - Severity: common.ParseSeverity(alert.Labels["severity"]), - Labels: alert.Labels, - }, - }) - } - return checkResults, nil -} - -// ToggleCheckAlert toggles the silence state of the check with the provided alertID. -func (s *Service) ToggleCheckAlert(ctx context.Context, alertID string, silence bool) error { - filters := &services.FilterParams{ - IsCheck: true, - AlertID: alertID, - } - res, err := s.alertmanagerService.GetAlerts(ctx, filters) - if err != nil { - return errors.Wrapf(err, "failed to get alerts with id: %s", alertID) - } - - if silence { - err = s.alertmanagerService.SilenceAlerts(ctx, res) - } else { - err = s.alertmanagerService.UnsilenceAlerts(ctx, res) - } - - return err + return s.alertsRegistry.getCheckResults(serviceID), nil } // runChecksGroup downloads and executes Advisors checks that should run in the interval specified by intervalGroup. @@ -411,11 +318,24 @@ func (s *Service) run(ctx context.Context, intervalGroup check.Interval, checkNa return errors.WithStack(err) } - if err := s.executeChecks(ctx, intervalGroup, checkNames); err != nil { + res, err := s.executeChecks(ctx, intervalGroup, checkNames) + if err != nil { return errors.WithStack(err) } - s.alertmanagerService.SendAlerts(ctx, s.alertsRegistry.collect()) + switch { + case len(checkNames) != 0: + // If we run some specific checks, delete previous results for them. + s.alertsRegistry.deleteByName(checkNames) + case intervalGroup != "": + // If we run whole interval group, delete previous results for that group. + s.alertsRegistry.deleteByInterval(intervalGroup) + default: + // If we run all checks, delete all previous results. + s.alertsRegistry.cleanup() + } + + s.alertsRegistry.set(res) return nil } @@ -706,46 +626,32 @@ func (s *Service) filterChecks(checks map[string]check.Check, group check.Interv // executeChecks runs checks for all reachable services. If intervalGroup specified only checks from that group will be // executed. If checkNames specified then only matched checks will be executed. -func (s *Service) executeChecks(ctx context.Context, intervalGroup check.Interval, checkNames []string) error { +func (s *Service) executeChecks(ctx context.Context, intervalGroup check.Interval, checkNames []string) ([]services.CheckResult, error) { disabledChecks, err := s.GetDisabledChecks() if err != nil { - return errors.WithStack(err) + return nil, errors.WithStack(err) } - var checkResults []services.CheckResult + var res []services.CheckResult checks, err := s.GetChecks() if err != nil { - return errors.WithStack(err) + return nil, errors.WithStack(err) } mySQLChecks, postgreSQLChecks, mongoDBChecks := groupChecksByDB(s.l, checks) mySQLChecks = s.filterChecks(mySQLChecks, intervalGroup, disabledChecks, checkNames) mySQLCheckResults := s.executeChecksForTargetType(ctx, models.MySQLServiceType, mySQLChecks) - checkResults = append(checkResults, mySQLCheckResults...) + res = append(res, mySQLCheckResults...) postgreSQLChecks = s.filterChecks(postgreSQLChecks, intervalGroup, disabledChecks, checkNames) postgreSQLCheckResults := s.executeChecksForTargetType(ctx, models.PostgreSQLServiceType, postgreSQLChecks) - checkResults = append(checkResults, postgreSQLCheckResults...) + res = append(res, postgreSQLCheckResults...) mongoDBChecks = s.filterChecks(mongoDBChecks, intervalGroup, disabledChecks, checkNames) mongoDBCheckResults := s.executeChecksForTargetType(ctx, models.MongoDBServiceType, mongoDBChecks) - checkResults = append(checkResults, mongoDBCheckResults...) - - switch { - case len(checkNames) != 0: - // If we run some specific checks, delete previous results for them. - s.alertsRegistry.deleteByName(checkNames) - case intervalGroup != "": - // If we run whole interval group, delete previous results for that group. - s.alertsRegistry.deleteByInterval(intervalGroup) - default: - // If we run all checks, delete all previous results. - s.alertsRegistry.cleanup() - } - - s.alertsRegistry.set(checkResults) + res = append(res, mongoDBCheckResults...) - return nil + return res, nil } func (s *Service) executeChecksForTargetType(ctx context.Context, serviceType models.ServiceType, checks map[string]check.Check) []services.CheckResult { @@ -767,8 +673,10 @@ func (s *Service) executeChecksForTargetType(ctx context.Context, serviceType mo s.mChecksExecuted.WithLabelValues(string(target.ServiceType), c.Advisor, c.Name, "error").Inc() continue } - s.mChecksExecuted.WithLabelValues(string(target.ServiceType), c.Advisor, c.Name, "ok").Inc() + res = append(res, results...) + + s.mChecksExecuted.WithLabelValues(string(target.ServiceType), c.Advisor, c.Name, "ok").Inc() } } diff --git a/managed/services/checks/checks_test.go b/managed/services/checks/checks_test.go index 1eba59211c..2d89d9ddbe 100644 --- a/managed/services/checks/checks_test.go +++ b/managed/services/checks/checks_test.go @@ -28,15 +28,12 @@ import ( "github.com/percona-platform/saas/pkg/common" metrics "github.com/prometheus/client_golang/api" v1 "github.com/prometheus/client_golang/api/prometheus/v1" - "github.com/prometheus/common/model" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "gopkg.in/reform.v1" "gopkg.in/reform.v1/dialects/postgresql" - "github.com/percona/pmm/api/alertmanager/ammodels" "github.com/percona/pmm/managed/models" "github.com/percona/pmm/managed/services" "github.com/percona/pmm/managed/utils/platform" @@ -72,7 +69,7 @@ func TestDownloadAdvisors(t *testing.T) { platformClient, err := platform.NewClient(db, devPlatformAddress) require.NoError(t, err) - s := New(db, platformClient, nil, nil, vmClient, clickhouseDB) + s := New(db, platformClient, nil, vmClient, clickhouseDB) s.platformPublicKeys = []string{devPlatformPublicKey} require.NoError(t, err) @@ -121,7 +118,7 @@ func TestDownloadAdvisors(t *testing.T) { } func TestLoadLocalChecks(t *testing.T) { - s := New(nil, nil, nil, nil, vmClient, clickhouseDB) + s := New(nil, nil, nil, vmClient, clickhouseDB) checks, err := s.loadLocalChecks(testChecksFile) require.NoError(t, err) @@ -167,7 +164,7 @@ func TestCollectAdvisors(t *testing.T) { require.NoError(t, err) t.Run("collect local checks", func(t *testing.T) { - s := New(db, platformClient, nil, nil, vmClient, clickhouseDB) + s := New(db, platformClient, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -198,7 +195,7 @@ func TestCollectAdvisors(t *testing.T) { }) t.Run("download checks", func(t *testing.T) { - s := New(db, platformClient, nil, nil, vmClient, clickhouseDB) + s := New(db, platformClient, nil, vmClient, clickhouseDB) s.platformPublicKeys = []string{devPlatformPublicKey} s.CollectAdvisors(context.Background()) @@ -231,7 +228,7 @@ func TestDisableChecks(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -260,7 +257,7 @@ func TestDisableChecks(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -292,7 +289,7 @@ func TestDisableChecks(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -315,7 +312,7 @@ func TestEnableChecks(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -341,8 +338,6 @@ func TestEnableChecks(t *testing.T) { func TestChangeInterval(t *testing.T) { t.Run("normal", func(t *testing.T) { - var ams mockAlertmanagerService - ams.On("SendAlerts", mock.Anything, mock.Anything).Return() sqlDB := testdb.Open(t, models.SkipFixtures, nil) t.Cleanup(func() { require.NoError(t, sqlDB.Close()) @@ -350,7 +345,7 @@ func TestChangeInterval(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) - s := New(db, nil, nil, &ams, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -395,7 +390,7 @@ func TestGetSecurityCheckResults(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) t.Run("STT enabled", func(t *testing.T) { - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) results, err := s.GetSecurityCheckResults() assert.Empty(t, results) @@ -403,7 +398,7 @@ func TestGetSecurityCheckResults(t *testing.T) { }) t.Run("STT disabled", func(t *testing.T) { - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) settings, err := models.GetSettings(db) require.NoError(t, err) @@ -428,7 +423,7 @@ func TestStartChecks(t *testing.T) { setupClients(t) t.Run("unknown interval", func(t *testing.T) { - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile err := s.runChecksGroup(context.Background(), check.Interval("unknown")) @@ -436,10 +431,7 @@ func TestStartChecks(t *testing.T) { }) t.Run("stt enabled", func(t *testing.T) { - var ams mockAlertmanagerService - ams.On("SendAlerts", mock.Anything, mock.Anything).Return() - - s := New(db, nil, nil, &ams, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) s.localChecksFile = testChecksFile s.CollectAdvisors(context.Background()) @@ -451,7 +443,7 @@ func TestStartChecks(t *testing.T) { }) t.Run("stt disabled", func(t *testing.T) { - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) settings, err := models.GetSettings(db) require.NoError(t, err) @@ -541,7 +533,7 @@ func TestFilterChecks(t *testing.T) { partiallyValidAdvisor.Checks = partiallyValidAdvisor.Checks[0:1] // remove invalid check expected := append(valid, partiallyValidAdvisor) //nolint:gocritic - s := New(nil, nil, nil, nil, vmClient, clickhouseDB) + s := New(nil, nil, nil, vmClient, clickhouseDB) actual := s.filterSupportedChecks(checks) assert.ElementsMatch(t, expected, actual) } @@ -566,7 +558,7 @@ func TestMinPMMAgents(t *testing.T) { {name: "PostgreSQL Family", minVersion: pmmAgent2_6_0, check: check.Check{Version: 2, Queries: []check.Query{{Type: check.PostgreSQLShow}, {Type: check.PostgreSQLSelect}}}}, } - s := New(nil, nil, nil, nil, vmClient, clickhouseDB) + s := New(nil, nil, nil, vmClient, clickhouseDB) for _, test := range tests { test := test @@ -627,7 +619,7 @@ func TestFindTargets(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, reform.NewPrintfLogger(t.Logf)) - s := New(db, nil, nil, nil, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) t.Run("unknown service", func(t *testing.T) { t.Parallel() @@ -680,7 +672,7 @@ func TestFindTargets(t *testing.T) { func TestFilterChecksByInterval(t *testing.T) { t.Parallel() - s := New(nil, nil, nil, nil, vmClient, clickhouseDB) + s := New(nil, nil, nil, vmClient, clickhouseDB) rareCheck := check.Check{Name: "rareCheck", Interval: check.Rare} standardCheck := check.Check{Name: "standardCheck", Interval: check.Standard} @@ -713,11 +705,7 @@ func TestGetFailedChecks(t *testing.T) { db := reform.NewDB(sqlDB, postgresql.Dialect, nil) t.Run("no failed check for service", func(t *testing.T) { - var ams mockAlertmanagerService - ctx := context.Background() - ams.On("GetAlerts", ctx, mock.Anything).Return([]*ammodels.GettableAlert{}, nil) - - s := New(db, nil, nil, &ams, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) results, err := s.GetChecksResults(context.Background(), "test_svc") assert.Empty(t, results) @@ -725,65 +713,112 @@ func TestGetFailedChecks(t *testing.T) { }) t.Run("non empty failed checks", func(t *testing.T) { - alertLabels := map[string]string{ - model.AlertNameLabel: "test_check", - "alert_id": "test_alert", - "service_name": "test_svc", - "service_id": "/service_id/test_svc1", - "interval_group": "frequent", - "severity": common.Severity(4).String(), - } - - testAlert := ammodels.GettableAlert{ - Annotations: map[string]string{ - "summary": "Check summary", - "description": "Check description", - "read_more_url": "https://www.example.com", + checkResults := []services.CheckResult{ + { + CheckName: "test_check", + Interval: check.Frequent, + Target: services.Target{ + ServiceName: "test_svc1", + ServiceID: "/service_id/test_svc1", + Labels: map[string]string{ + "targetLabel": "targetLabelValue", + }, + }, + Result: check.Result{ + Summary: "Check summary", + Description: "Check description", + ReadMoreURL: "https://www.example.com", + Severity: common.Error, + Labels: map[string]string{ + "resultLabel": "reslutLabelValue", + }, + }, }, - Alert: ammodels.Alert{ - Labels: alertLabels, + { + CheckName: "test_check2", + Interval: check.Frequent, + Target: services.Target{ + ServiceName: "test_svc2", + ServiceID: "/service_id/test_svc2", + Labels: map[string]string{ + "targetLabel": "targetLabelValue", + }, + }, + Result: check.Result{ + Summary: "Check summary", + Description: "Check description", + ReadMoreURL: "https://www.example.com", + Severity: common.Error, + Labels: map[string]string{ + "resultLabel": "reslutLabelValue", + }, + }, }, - Status: &ammodels.AlertStatus{}, } - results := []services.CheckResult{ + s := New(db, nil, nil, vmClient, clickhouseDB) + s.alertsRegistry.set(checkResults) + + response, err := s.GetChecksResults(context.Background(), "") + require.NoError(t, err) + assert.ElementsMatch(t, checkResults, response) + }) + + t.Run("non empty failed checks for specific service", func(t *testing.T) { + checkResults := []services.CheckResult{ { CheckName: "test_check", - AlertID: "test_alert", - Silenced: false, Interval: check.Frequent, Target: services.Target{ - ServiceName: "test_svc", + ServiceName: "test_svc1", ServiceID: "/service_id/test_svc1", - Labels: alertLabels, + Labels: map[string]string{ + "targetLabel": "targetLabelValue", + }, }, Result: check.Result{ Summary: "Check summary", Description: "Check description", ReadMoreURL: "https://www.example.com", Severity: common.Error, - Labels: alertLabels, + Labels: map[string]string{ + "resultLabel": "reslutLabelValue", + }, + }, + }, + { + CheckName: "test_check2", + Interval: check.Frequent, + Target: services.Target{ + ServiceName: "test_svc2", + ServiceID: "/service_id/test_svc2", + Labels: map[string]string{ + "targetLabel": "targetLabelValue", + }, + }, + Result: check.Result{ + Summary: "Check summary", + Description: "Check description", + ReadMoreURL: "https://www.example.com", + Severity: common.Error, + Labels: map[string]string{ + "resultLabel": "reslutLabelValue", + }, }, }, } - ams := mockAlertmanagerService{} - ctx := context.Background() - ams.On("GetAlerts", ctx, mock.Anything).Return([]*ammodels.GettableAlert{&testAlert}, nil) - - s := New(db, nil, nil, &ams, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) + s.alertsRegistry.set(checkResults) - response, err := s.GetChecksResults(ctx, "test_svc") + response, err := s.GetChecksResults(context.Background(), "/service_id/test_svc1") require.NoError(t, err) - assert.Equal(t, results, response) + require.Len(t, response, 1) + assert.Equal(t, checkResults[0], response[0]) }) t.Run("STT disabled", func(t *testing.T) { - ams := mockAlertmanagerService{} - ctx := context.Background() - ams.On("GetAlerts", ctx, mock.Anything).Return(nil, services.ErrAdvisorsDisabled) - - s := New(db, nil, nil, &ams, vmClient, clickhouseDB) + s := New(db, nil, nil, vmClient, clickhouseDB) settings, err := models.GetSettings(db) require.NoError(t, err) @@ -792,66 +827,12 @@ func TestGetFailedChecks(t *testing.T) { err = models.SaveSettings(db, settings) require.NoError(t, err) - results, err := s.GetChecksResults(ctx, "test_svc") + results, err := s.GetChecksResults(context.Background(), "test_svc") assert.Nil(t, results) assert.ErrorIs(t, err, services.ErrAdvisorsDisabled) }) } -func TestToggleCheckAlert(t *testing.T) { - t.Parallel() - - t.Run("silence alert", func(t *testing.T) { - t.Parallel() - - testAlert := &ammodels.GettableAlert{ - Alert: ammodels.Alert{ - Labels: map[string]string{ - "alert_id": "test_alert_1", - }, - }, - Status: &ammodels.AlertStatus{}, - } - - var ams mockAlertmanagerService - ctx := context.Background() - ams.On("GetAlerts", ctx, mock.Anything).Return([]*ammodels.GettableAlert{testAlert}, nil) - ams.On("SilenceAlerts", ctx, []*ammodels.GettableAlert{testAlert}).Return(nil) - - s := New(nil, nil, nil, &ams, vmClient, clickhouseDB) - - active := len(testAlert.Status.SilencedBy) == 0 - err := s.ToggleCheckAlert(ctx, "test_alert_1", active) - require.NoError(t, err) - ams.AssertCalled(t, "SilenceAlerts", ctx, []*ammodels.GettableAlert{testAlert}) - }) - - t.Run("unsilence alert", func(t *testing.T) { - t.Parallel() - - testAlert := &ammodels.GettableAlert{ - Alert: ammodels.Alert{ - Labels: map[string]string{ - "alert_id": "test_alert_2", - }, - }, - Status: &ammodels.AlertStatus{SilencedBy: []string{"test_silence"}}, - } - - var ams mockAlertmanagerService - ctx := context.Background() - ams.On("GetAlerts", ctx, mock.Anything).Return([]*ammodels.GettableAlert{testAlert}, nil) - ams.On("UnsilenceAlerts", ctx, []*ammodels.GettableAlert{testAlert}).Return(nil) - - s := New(nil, nil, nil, &ams, vmClient, clickhouseDB) - - active := len(testAlert.Status.SilencedBy) == 0 - err := s.ToggleCheckAlert(ctx, "test_alert_1", active) - require.NoError(t, err) - ams.AssertCalled(t, "UnsilenceAlerts", ctx, []*ammodels.GettableAlert{testAlert}) - }) -} - func TestFillQueryPlaceholders(t *testing.T) { t.Parallel() diff --git a/managed/services/checks/deps.go b/managed/services/checks/deps.go index d4b3feeccb..267d69b5f5 100644 --- a/managed/services/checks/deps.go +++ b/managed/services/checks/deps.go @@ -18,13 +18,10 @@ package checks import ( "context" - "github.com/percona/pmm/api/alertmanager/ammodels" "github.com/percona/pmm/managed/models" - "github.com/percona/pmm/managed/services" ) //go:generate ../../../bin/mockery --name=agentsRegistry --case=snake --inpackage --testonly -//go:generate ../../../bin/mockery --name=alertmanagerService --case=snake --inpackage --testonly // agentsRegistry is a subset of methods of agents.Registry used by this package. // We use it instead of real type for testing and to avoid dependency cycle. @@ -39,12 +36,3 @@ type agentsRegistry interface { StartMongoDBQueryReplSetGetStatusAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error StartMongoDBQueryGetDiagnosticDataAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error } - -// alertmanagerService is a subset of methods of alertmanager.Service used by this package. -// We use it instead of real type for testing and to avoid dependency cycle. -type alertmanagerService interface { - SendAlerts(ctx context.Context, alerts ammodels.PostableAlerts) - SilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error - UnsilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error - GetAlerts(ctx context.Context, params *services.FilterParams) ([]*ammodels.GettableAlert, error) -} diff --git a/managed/services/checks/mock_alertmanager_service_test.go b/managed/services/checks/mock_alertmanager_service_test.go deleted file mode 100644 index 4877388dc3..0000000000 --- a/managed/services/checks/mock_alertmanager_service_test.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by mockery v2.33.0. DO NOT EDIT. - -package checks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - ammodels "github.com/percona/pmm/api/alertmanager/ammodels" - services "github.com/percona/pmm/managed/services" -) - -// mockAlertmanagerService is an autogenerated mock type for the alertmanagerService type -type mockAlertmanagerService struct { - mock.Mock -} - -// GetAlerts provides a mock function with given fields: ctx, params -func (_m *mockAlertmanagerService) GetAlerts(ctx context.Context, params *services.FilterParams) ([]*ammodels.GettableAlert, error) { - ret := _m.Called(ctx, params) - - var r0 []*ammodels.GettableAlert - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *services.FilterParams) ([]*ammodels.GettableAlert, error)); ok { - return rf(ctx, params) - } - if rf, ok := ret.Get(0).(func(context.Context, *services.FilterParams) []*ammodels.GettableAlert); ok { - r0 = rf(ctx, params) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*ammodels.GettableAlert) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *services.FilterParams) error); ok { - r1 = rf(ctx, params) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SendAlerts provides a mock function with given fields: ctx, alerts -func (_m *mockAlertmanagerService) SendAlerts(ctx context.Context, alerts ammodels.PostableAlerts) { - _m.Called(ctx, alerts) -} - -// SilenceAlerts provides a mock function with given fields: ctx, alerts -func (_m *mockAlertmanagerService) SilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error { - ret := _m.Called(ctx, alerts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []*ammodels.GettableAlert) error); ok { - r0 = rf(ctx, alerts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// UnsilenceAlerts provides a mock function with given fields: ctx, alerts -func (_m *mockAlertmanagerService) UnsilenceAlerts(ctx context.Context, alerts []*ammodels.GettableAlert) error { - ret := _m.Called(ctx, alerts) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, []*ammodels.GettableAlert) error); ok { - r0 = rf(ctx, alerts) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// newMockAlertmanagerService creates a new instance of mockAlertmanagerService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func newMockAlertmanagerService(t interface { - mock.TestingT - Cleanup(func()) -}, -) *mockAlertmanagerService { - mock := &mockAlertmanagerService{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/managed/services/checks/registry.go b/managed/services/checks/registry.go index b357de660a..2be7d5c706 100644 --- a/managed/services/checks/registry.go +++ b/managed/services/checks/registry.go @@ -16,18 +16,11 @@ package checks import ( - "crypto/sha1" //nolint:gosec - "encoding/hex" - "fmt" "sync" - "time" - "github.com/go-openapi/strfmt" "github.com/percona-platform/saas/pkg/check" prom "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/common/model" - "github.com/percona/pmm/api/alertmanager/ammodels" "github.com/percona/pmm/managed/services" ) @@ -36,20 +29,13 @@ type registry struct { rw sync.RWMutex // Results stored grouped by interval and by check name. It allows us to remove results for specific group. checkResults map[check.Interval]map[string][]services.CheckResult - - alertTTL time.Duration - nowF func() time.Time // for tests - - mInsights *prom.GaugeVec + mInsights *prom.GaugeVec } // newRegistry creates a new registry. -func newRegistry(alertTTL time.Duration) *registry { +func newRegistry() *registry { return ®istry{ checkResults: make(map[check.Interval]map[string][]services.CheckResult), - alertTTL: alertTTL, - nowF: time.Now, - mInsights: prom.NewGaugeVec(prom.GaugeOpts{ Namespace: prometheusNamespace, Subsystem: prometheusSubsystem, @@ -105,70 +91,25 @@ func (r *registry) cleanup() { r.checkResults = make(map[check.Interval]map[string][]services.CheckResult) } -// collect returns a slice of alerts created from the stored check results. -func (r *registry) collect() ammodels.PostableAlerts { +// getCheckResults returns checks results for the given service. If serviceID is empty it returns results for all services. +func (r *registry) getCheckResults(serviceID string) []services.CheckResult { r.rw.RLock() defer r.rw.RUnlock() - var alerts ammodels.PostableAlerts + var results []services.CheckResult for _, intervalGroup := range r.checkResults { for _, checkNameGroup := range intervalGroup { for _, checkResult := range checkNameGroup { - checkResult := checkResult - alerts = append(alerts, r.createAlert(&checkResult)) + if serviceID == "" || checkResult.Target.ServiceID == serviceID { + results = append(results, checkResult) + } } } } - return alerts -} - -func (r *registry) getCheckResults() []services.CheckResult { - r.rw.RLock() - defer r.rw.RUnlock() - - var results []services.CheckResult - for _, intervalGroup := range r.checkResults { - for _, checkNameGroup := range intervalGroup { - results = append(results, checkNameGroup...) - } - } return results } -func (r *registry) createAlert(checkResult *services.CheckResult) *ammodels.PostableAlert { - name, target, result, alertTTL := checkResult.CheckName, &checkResult.Target, &checkResult.Result, r.alertTTL - labels := make(map[string]string, len(target.Labels)+len(result.Labels)+4) - annotations := make(map[string]string, 2) - for k, v := range result.Labels { - labels[k] = v - } - for k, v := range target.Labels { - labels[k] = v - } - - labels[model.AlertNameLabel] = name - checkResult.AlertID = makeID(target, result) - labels["severity"] = result.Severity.String() - labels["stt_check"] = "1" - labels["alert_id"] = checkResult.AlertID - labels["interval_group"] = string(checkResult.Interval) - - annotations["summary"] = result.Summary - annotations["description"] = result.Description - annotations["read_more_url"] = result.ReadMoreURL - - endsAt := r.nowF().Add(alertTTL).UTC().Round(0) // strip a monotonic clock reading - return &ammodels.PostableAlert{ - Alert: ammodels.Alert{ - // GeneratorURL: "TODO", - Labels: labels, - }, - EndsAt: strfmt.DateTime(endsAt), - Annotations: annotations, - } -} - // Describe implements prom.Collector. func (r *registry) Describe(ch chan<- *prom.Desc) { r.mInsights.Describe(ch) @@ -177,21 +118,9 @@ func (r *registry) Describe(ch chan<- *prom.Desc) { // Collect implements prom.Collector. func (r *registry) Collect(ch chan<- prom.Metric) { r.mInsights.Reset() - res := r.getCheckResults() + res := r.getCheckResults("") for _, re := range res { r.mInsights.WithLabelValues(string(re.Target.ServiceType), re.AdvisorName, re.CheckName).Inc() } r.mInsights.Collect(ch) } - -// makeID creates an ID for STT check alert. -func makeID(target *services.Target, result *check.Result) string { - s := sha1.New() //nolint:gosec - fmt.Fprintf(s, "%s\n", target.AgentID) - fmt.Fprintf(s, "%s\n", target.ServiceID) - fmt.Fprintf(s, "%s\n", result.Summary) - fmt.Fprintf(s, "%s\n", result.Description) - fmt.Fprintf(s, "%s\n", result.ReadMoreURL) - fmt.Fprintf(s, "%v\n", result.Severity) - return alertsPrefix + hex.EncodeToString(s.Sum(nil)) -} diff --git a/managed/services/checks/registry_test.go b/managed/services/checks/registry_test.go index 0b4ca97e9b..ae5eb55f1d 100644 --- a/managed/services/checks/registry_test.go +++ b/managed/services/checks/registry_test.go @@ -17,25 +17,18 @@ package checks import ( "testing" - "time" - "github.com/go-openapi/strfmt" "github.com/percona-platform/saas/pkg/check" "github.com/percona-platform/saas/pkg/common" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/percona/pmm/api/alertmanager/ammodels" "github.com/percona/pmm/managed/services" ) func TestRegistry(t *testing.T) { t.Run("create and collect Alerts", func(t *testing.T) { - alertTTL := resolveTimeoutFactor * defaultResendInterval - r := newRegistry(alertTTL) - - nowValue := time.Now().UTC().Round(0) // strip a monotonic clock reading - r.nowF = func() time.Time { return nowValue } + r := newRegistry() checkResults := []services.CheckResult{ { CheckName: "name", @@ -80,57 +73,15 @@ func TestRegistry(t *testing.T) { r.set(checkResults) - expectedAlerts := []*ammodels.PostableAlert{ - { - Annotations: map[string]string{ - "summary": "check summary", - "description": "check description", - "read_more_url": "https://www.example.com", - }, - EndsAt: strfmt.DateTime(nowValue.Add(alertTTL)), - Alert: ammodels.Alert{ - Labels: map[string]string{ - "alert_id": "/stt/e7b471407fe9734eac5b6adb178ee0ef08ef45f2", - "alertname": "name", - "baz": "qux", - "foo": "bar", - "severity": "warning", - "stt_check": "1", - "interval_group": string(check.Standard), - }, - }, - }, - { - Annotations: map[string]string{ - "summary": "check summary 2", - "description": "check description 2", - "read_more_url": "https://www.example2.com", - }, - EndsAt: strfmt.DateTime(nowValue.Add(alertTTL)), - Alert: ammodels.Alert{ - Labels: map[string]string{ - "alert_id": "/stt/8fa5695dc34160333eeeb05f00bf1ddbd98be59c", - "alertname": "name2", - "qux": "baz", - "bar": "foo", - "severity": "notice", - "stt_check": "1", - "interval_group": string(check.Standard), - }, - }, - }, - } + // Empty interval means standard + checkResults[1].Interval = check.Standard - collectedAlerts := r.collect() - assert.ElementsMatch(t, expectedAlerts, collectedAlerts) + collectedAlerts := r.getCheckResults("") + assert.ElementsMatch(t, checkResults, collectedAlerts) }) t.Run("delete check results by interval", func(t *testing.T) { - alertTTL := resolveTimeoutFactor * defaultResendInterval - r := newRegistry(alertTTL) - - nowValue := time.Now().UTC().Round(0) // strip a monotonic clock reading - r.nowF = func() time.Time { return nowValue } + r := newRegistry() checkResults := []services.CheckResult{ { CheckName: "name", @@ -177,40 +128,17 @@ func TestRegistry(t *testing.T) { r.set(checkResults) r.deleteByInterval(check.Standard) - expectedAlert := &ammodels.PostableAlert{ - Annotations: map[string]string{ - "summary": "check summary 2", - "description": "check description 2", - "read_more_url": "https://www.example2.com", - }, - EndsAt: strfmt.DateTime(nowValue.Add(alertTTL)), - Alert: ammodels.Alert{ - Labels: map[string]string{ - "alert_id": "/stt/8fa5695dc34160333eeeb05f00bf1ddbd98be59c", - "alertname": "name2", - "qux": "baz", - "bar": "foo", - "severity": "notice", - "stt_check": "1", - "interval_group": string(check.Frequent), - }, - }, - } - - collectedAlerts := r.collect() + collectedAlerts := r.getCheckResults("") require.Len(t, collectedAlerts, 1) - assert.Equal(t, expectedAlert, collectedAlerts[0]) + assert.Equal(t, checkResults[1], collectedAlerts[0]) }) t.Run("delete check result by name", func(t *testing.T) { - alertTTL := resolveTimeoutFactor * defaultResendInterval - r := newRegistry(alertTTL) - - nowValue := time.Now().UTC().Round(0) // strip a monotonic clock reading - r.nowF = func() time.Time { return nowValue } + r := newRegistry() checkResults := []services.CheckResult{ { CheckName: "name1", + Interval: check.Standard, Target: services.Target{ AgentID: "/agent_id/123", ServiceID: "/service_id/123", @@ -230,6 +158,7 @@ func TestRegistry(t *testing.T) { }, { CheckName: "name2", + Interval: check.Standard, Target: services.Target{ AgentID: "/agent_id/321", ServiceID: "/service_id/321", @@ -252,37 +181,13 @@ func TestRegistry(t *testing.T) { r.set(checkResults) r.deleteByName([]string{"name1"}) - expectedAlert := &ammodels.PostableAlert{ - Annotations: map[string]string{ - "summary": "check summary 2", - "description": "check description 2", - "read_more_url": "https://www.example2.com", - }, - EndsAt: strfmt.DateTime(nowValue.Add(alertTTL)), - Alert: ammodels.Alert{ - Labels: map[string]string{ - "alert_id": "/stt/8fa5695dc34160333eeeb05f00bf1ddbd98be59c", - "alertname": "name2", - "qux": "baz", - "bar": "foo", - "severity": "notice", - "stt_check": "1", - "interval_group": string(check.Standard), - }, - }, - } - - collectedAlerts := r.collect() + collectedAlerts := r.getCheckResults("") require.Len(t, collectedAlerts, 1) - assert.Equal(t, expectedAlert, collectedAlerts[0]) + assert.Equal(t, checkResults[1], collectedAlerts[0]) }) t.Run("empty interval recognized as standard", func(t *testing.T) { - alertTTL := resolveTimeoutFactor * defaultResendInterval - r := newRegistry(alertTTL) - - nowValue := time.Now().UTC().Round(0) // strip a monotonic clock reading - r.nowF = func() time.Time { return nowValue } + r := newRegistry() checkResults := []services.CheckResult{ { CheckName: "name", @@ -328,7 +233,7 @@ func TestRegistry(t *testing.T) { r.set(checkResults) r.deleteByInterval(check.Standard) - collectedAlerts := r.collect() + collectedAlerts := r.getCheckResults("") assert.Empty(t, collectedAlerts) }) } diff --git a/managed/services/converters.go b/managed/services/converters.go index edfcf3f4e9..299776441c 100644 --- a/managed/services/converters.go +++ b/managed/services/converters.go @@ -475,7 +475,7 @@ func ToAPIAgent(q *reform.Querier, agent *models.Agent) (inventorypb.Agent, erro } // SpecifyLogLevel - convert proto enum to string -// mysqld_exporter, node_exporter and postgres_exporter don't support --log.level=fatal +// mysqld_exporter, node_exporter and postgres_exporter don't support --log.level=fatal. func SpecifyLogLevel(variant, minLogLevel inventorypb.LogLevel) string { if variant == inventorypb.LogLevel_auto { return "" diff --git a/managed/services/dbaas/kubernetes/client/database/database.go b/managed/services/dbaas/kubernetes/client/database/database.go index f803a10e72..d5a0aacda7 100644 --- a/managed/services/dbaas/kubernetes/client/database/database.go +++ b/managed/services/dbaas/kubernetes/client/database/database.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package database TODO +// Package database TODO. package database import ( diff --git a/managed/services/grafana/auth_server.go b/managed/services/grafana/auth_server.go index 5f39ba3d8c..72d0368b00 100644 --- a/managed/services/grafana/auth_server.go +++ b/managed/services/grafana/auth_server.go @@ -358,9 +358,14 @@ func (s *AuthServer) getFiltersForVMProxy(userID int) ([]string, error) { filters := make([]string, 0, len(roles)) for _, r := range roles { - if r.Filter != "" { - filters = append(filters, r.Filter) + if r.Filter == "" { + // Special case when a user has assigned a role with no filters. + // In this case it's irrelevant what other roles are assigned to the user. + // The user shall have full access. + return []string{}, nil } + + filters = append(filters, r.Filter) } return filters, nil } diff --git a/managed/services/grafana/auth_server_test.go b/managed/services/grafana/auth_server_test.go index c6e3da8a57..1c02bfe0d4 100644 --- a/managed/services/grafana/auth_server_test.go +++ b/managed/services/grafana/auth_server_test.go @@ -294,18 +294,27 @@ func TestAuthServerAddVMGatewayToken(t *testing.T) { c := NewClient("127.0.0.1:3000") s := NewAuthServer(c, &checker, db) - var roleA models.Role - roleA.Title = "Role A" - roleA.Filter = "filter A" + roleA := models.Role{ + Title: "Role A", + Filter: "filter A", + } err := models.CreateRole(db.Querier, &roleA) require.NoError(t, err) - var roleB models.Role - roleB.Title = "Role B" - roleB.Filter = "filter B" + roleB := models.Role{ + Title: "Role B", + Filter: "filter B", + } err = models.CreateRole(db.Querier, &roleB) require.NoError(t, err) + roleC := models.Role{ + Title: "Role C", + Filter: "", + } + err = models.CreateRole(db.Querier, &roleC) + require.NoError(t, err) + // Enable access control _, err = models.UpdateSettings(db.Querier, &models.ChangeSettingsParams{ EnableAccessControl: true, @@ -315,6 +324,7 @@ func TestAuthServerAddVMGatewayToken(t *testing.T) { for userID, roleIDs := range map[int][]int{ 1337: {int(roleA.ID)}, 1338: {int(roleA.ID), int(roleB.ID)}, + 1339: {int(roleA.ID), int(roleC.ID)}, 1: {int(roleA.ID)}, } { err := db.InTransaction(func(tx *reform.TX) error { @@ -382,6 +392,19 @@ func TestAuthServerAddVMGatewayToken(t *testing.T) { require.Equal(t, parsed[0], "filter A") require.Equal(t, parsed[1], "filter B") }) + + //nolint:paralleltest + t.Run("shall not add any filters if at least one role has full access", func(t *testing.T) { + rw := httptest.NewRecorder() + req, err := http.NewRequestWithContext(ctx, http.MethodGet, "/prometheus/api/v1/", nil) + require.NoError(t, err) + + err = s.maybeAddVMProxyFilters(ctx, rw, req, 1339, logrus.WithField("test", t.Name())) + require.NoError(t, err) + + headerString := rw.Header().Get(vmProxyHeaderName) + require.Equal(t, len(headerString), 0) + }) } func Test_cleanPath(t *testing.T) { diff --git a/managed/services/management/checks.go b/managed/services/management/checks.go index 705448cd0e..999e63b733 100644 --- a/managed/services/management/checks.go +++ b/managed/services/management/checks.go @@ -122,17 +122,23 @@ func (s *ChecksAPIService) GetFailedChecks(ctx context.Context, req *managementp failedChecks := make([]*managementpb.CheckResult, 0, len(results)) for _, result := range results { + labels := make(map[string]string, len(result.Target.Labels)+len(result.Result.Labels)) + for k, v := range result.Result.Labels { + labels[k] = v + } + for k, v := range result.Target.Labels { + labels[k] = v + } + failedChecks = append(failedChecks, &managementpb.CheckResult{ Summary: result.Result.Summary, CheckName: result.CheckName, Description: result.Result.Description, ReadMoreUrl: result.Result.ReadMoreURL, Severity: managementpb.Severity(result.Result.Severity), - Labels: result.Result.Labels, + Labels: labels, ServiceName: result.Target.ServiceName, ServiceId: result.Target.ServiceID, - AlertId: result.AlertID, - Silenced: result.Silenced, }) } @@ -167,12 +173,7 @@ func (s *ChecksAPIService) GetFailedChecks(ctx context.Context, req *managementp // ToggleCheckAlert toggles the silence state of the check with the provided alertID. func (s *ChecksAPIService) ToggleCheckAlert(ctx context.Context, req *managementpb.ToggleCheckAlertRequest) (*managementpb.ToggleCheckAlertResponse, error) { - err := s.checksService.ToggleCheckAlert(ctx, req.AlertId, req.Silence) - if err != nil { - return nil, errors.Wrapf(err, "failed to toggle silence status of alert with id: %s", req.AlertId) - } - - return &managementpb.ToggleCheckAlertResponse{}, nil + return nil, status.Error(codes.NotFound, "Advisor alerts silencing is not supported anymore.") } // GetSecurityCheckResults returns Security Thread Tool's latest checks results. diff --git a/managed/services/management/deps.go b/managed/services/management/deps.go index 1a873f89a4..b87ae574e3 100644 --- a/managed/services/management/deps.go +++ b/managed/services/management/deps.go @@ -71,7 +71,6 @@ type checksService interface { DisableChecks(checkNames []string) error EnableChecks(checkNames []string) error ChangeInterval(params map[string]check.Interval) error - ToggleCheckAlert(ctx context.Context, alertID string, newStatus bool) error } // grafanaClient is a subset of methods of grafana.Client used by this package. diff --git a/managed/services/management/ia/alerts_service.go b/managed/services/management/ia/alerts_service.go index fe882023e8..575d3c687f 100644 --- a/managed/services/management/ia/alerts_service.go +++ b/managed/services/management/ia/alerts_service.go @@ -38,7 +38,7 @@ import ( ) // AlertsService represents integrated alerting alerts API. -// Deprecated. Do not use +// Deprecated. Do not use. type AlertsService struct { db *reform.DB l *logrus.Entry @@ -59,7 +59,7 @@ func NewAlertsService(db *reform.DB, alertManager alertManager, templatesService } // Enabled returns if service is enabled and can be used. -// Deprecated. Do not use +// Deprecated. Do not use. func (s *AlertsService) Enabled() bool { settings, err := models.GetSettings(s.db) if err != nil { @@ -70,7 +70,7 @@ func (s *AlertsService) Enabled() bool { } // ListAlerts returns list of existing alerts. -// Deprecated. Do not use +// Deprecated. Do not use. func (s *AlertsService) ListAlerts(ctx context.Context, req *iav1beta1.ListAlertsRequest) (*iav1beta1.ListAlertsResponse, error) { filter := &services.FilterParams{ IsIA: true, @@ -228,7 +228,7 @@ func getAlertID(alert *ammodels.GettableAlert) string { } // ToggleAlerts allows to silence/unsilence specified alerts. -// Deprecated. Do not use +// Deprecated. Do not use. func (s *AlertsService) ToggleAlerts(ctx context.Context, req *iav1beta1.ToggleAlertsRequest) (*iav1beta1.ToggleAlertsResponse, error) { var err error var alerts []*ammodels.GettableAlert diff --git a/managed/services/management/ia/rules_service_test.go b/managed/services/management/ia/rules_service_test.go index 542e621cb2..f264e6c5c5 100644 --- a/managed/services/management/ia/rules_service_test.go +++ b/managed/services/management/ia/rules_service_test.go @@ -358,7 +358,7 @@ import ( // _, err = os.Stat(filename) // assert.EqualError(t, err, fmt.Sprintf("stat %s: no such file or directory", filename)) // }) -// } +// }. */ func ruleFileName(testDir, ruleID string) string { diff --git a/managed/services/management/mock_checks_service_test.go b/managed/services/management/mock_checks_service_test.go index 53131de5ab..d28cd5cb01 100644 --- a/managed/services/management/mock_checks_service_test.go +++ b/managed/services/management/mock_checks_service_test.go @@ -202,20 +202,6 @@ func (_m *mockChecksService) StartChecks(checkNames []string) error { return r0 } -// ToggleCheckAlert provides a mock function with given fields: ctx, alertID, newStatus -func (_m *mockChecksService) ToggleCheckAlert(ctx context.Context, alertID string, newStatus bool) error { - ret := _m.Called(ctx, alertID, newStatus) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, bool) error); ok { - r0 = rf(ctx, alertID, newStatus) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // newMockChecksService creates a new instance of mockChecksService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func newMockChecksService(t interface { diff --git a/managed/services/management/rds.go b/managed/services/management/rds.go index fbcc349ccc..4b4b2723d0 100644 --- a/managed/services/management/rds.go +++ b/managed/services/management/rds.go @@ -43,7 +43,7 @@ import ( ) const ( - // Maximum time for AWS discover APIs calls + // Maximum time for AWS discover APIs calls. awsDiscoverTimeout = 7 * time.Second ) @@ -66,7 +66,7 @@ func NewRDSService(db *reform.DB, state agentsStateUpdater, cc connectionChecker } var ( - // See https://pkg.go.dev/github.com/aws/aws-sdk-go/service/rds?tab=doc#CreateDBInstanceInput, Engine field + // See https://pkg.go.dev/github.com/aws/aws-sdk-go/service/rds?tab=doc#CreateDBInstanceInput, Engine field. rdsEngines = map[string]managementpb.DiscoverRDSEngine{ "aurora-mysql": managementpb.DiscoverRDSEngine_DISCOVER_RDS_MYSQL, // MySQL 5.7-compatible Aurora diff --git a/managed/services/server/server.go b/managed/services/server/server.go index 258fb7647f..08bec308bc 100644 --- a/managed/services/server/server.go +++ b/managed/services/server/server.go @@ -513,6 +513,7 @@ func (s *Server) validateChangeSettingsRequest(ctx context.Context, req *serverp if req.PmmPublicAddress != "" && req.RemovePmmPublicAddress { return status.Error(codes.InvalidArgument, "Both pmm_public_address and remove_pmm_public_address are present.") } + if req.SshKey != "" { if err := s.validateSSHKey(ctx, req.SshKey); err != nil { return err @@ -797,7 +798,7 @@ func (s *Server) TestEmailAlertingSettings( return &serverpb.TestEmailAlertingSettingsResponse{}, nil } -// UpdateConfigurations updates supervisor config and requests configuration update for VictoriaMetrics components. +// UpdateConfigurations updates supervisor config and requests configuration update for PMM components. func (s *Server) UpdateConfigurations(ctx context.Context) error { settings, err := models.GetSettings(s.db) if err != nil { diff --git a/managed/services/supervisord/supervisord.go b/managed/services/supervisord/supervisord.go index 40f7e21061..29490ff66d 100644 --- a/managed/services/supervisord/supervisord.go +++ b/managed/services/supervisord/supervisord.go @@ -76,7 +76,7 @@ type sub struct { eventTypes []eventType } -// values from supervisord configuration +// values from supervisord configuration. const ( pmmUpdatePerformProgram = "pmm-update-perform" pmmUpdatePerformLog = "/srv/logs/pmm-update-perform.log" @@ -445,6 +445,19 @@ func (s *Service) marshalConfig(tmpl *template.Template, settings *models.Settin s.addPostgresParams(templateParams) + templateParams["PMMServerHost"] = "" + if settings.PMMPublicAddress != "" { + publicURL, err := url.Parse(settings.PMMPublicAddress) + if err != nil { + return nil, errors.Wrap(err, "failed to parse PMM public address.") + } + if publicURL.Host == "" { + if publicURL, err = url.Parse(fmt.Sprintf("https://%s", settings.PMMPublicAddress)); err != nil { + return nil, errors.Wrap(err, "failed to parse PMM public address.") + } + } + templateParams["PMMServerHost"] = publicURL.Host + } if ssoDetails != nil { u, err := url.Parse(ssoDetails.IssuerURL) if err != nil { @@ -782,8 +795,10 @@ command = /usr/sbin/grafana server --homepath=/usr/share/grafana --config=/etc/grafana/grafana.ini + {{- if .PMMServerHost}} + cfg:default.server.domain="{{ .PMMServerHost }}" + {{- end}} {{- if .PerconaSSODetails}} - cfg:default.server.domain="{{ .PMMServerAddress }}" cfg:default.auth.generic_oauth.enabled=true cfg:default.auth.generic_oauth.name="Percona Account" cfg:default.auth.generic_oauth.client_id="{{ .PerconaSSODetails.GrafanaClientID }}" diff --git a/managed/services/telemetry/datasource_pmmdb_select.go b/managed/services/telemetry/datasource_pmmdb_select.go index 6e2d03c040..75bfdc9d7b 100644 --- a/managed/services/telemetry/datasource_pmmdb_select.go +++ b/managed/services/telemetry/datasource_pmmdb_select.go @@ -33,7 +33,7 @@ type dsPmmDBSelect struct { db *sql.DB } -// check interfaces +// check interfaces. var ( _ DataSource = (*dsPmmDBSelect)(nil) ) diff --git a/managed/services/telemetry/datasource_qandb_select.go b/managed/services/telemetry/datasource_qandb_select.go index d53a122d86..0aa29a5778 100644 --- a/managed/services/telemetry/datasource_qandb_select.go +++ b/managed/services/telemetry/datasource_qandb_select.go @@ -31,7 +31,7 @@ type dsQanDBSelect struct { db *sql.DB } -// check interfaces +// check interfaces. var ( _ DataSource = (*dsQanDBSelect)(nil) ) diff --git a/managed/services/telemetry/datasource_victoria_metrics.go b/managed/services/telemetry/datasource_victoria_metrics.go index 7b3365f31c..2c406d4301 100644 --- a/managed/services/telemetry/datasource_victoria_metrics.go +++ b/managed/services/telemetry/datasource_victoria_metrics.go @@ -33,7 +33,7 @@ type dataSourceVictoriaMetrics struct { vm v1.API } -// check interfaces +// check interfaces. var ( _ DataSource = (*dataSourceVictoriaMetrics)(nil) ) diff --git a/managed/services/telemetry/datasources.go b/managed/services/telemetry/datasources.go index 79276d8aac..6f116bc0e9 100644 --- a/managed/services/telemetry/datasources.go +++ b/managed/services/telemetry/datasources.go @@ -35,7 +35,7 @@ type dataSourceRegistry struct { dataSources map[DataSourceName]DataSource } -// NewDataSourceRegistry makes new data source registry +// NewDataSourceRegistry makes new data source registry. func NewDataSourceRegistry(config ServiceConfig, l *logrus.Entry) (DataSourceLocator, error) { //nolint:ireturn pmmDB, err := NewDsPmmDBSelect(*config.DataSources.PmmDBSelect, l) if err != nil { diff --git a/managed/services/telemetry/deps.go b/managed/services/telemetry/deps.go index 148bd529a7..465e757e95 100644 --- a/managed/services/telemetry/deps.go +++ b/managed/services/telemetry/deps.go @@ -29,12 +29,12 @@ import ( //go:generate ../../../bin/mockery --name=DataSourceLocator --case=snake --inpackage --testonly //go:generate ../../../bin/mockery --name=DataSource --case=snake --inpackage --testonly -// distributionUtilService service to get info about OS on which pmm server is running +// distributionUtilService service to get info about OS on which pmm server is running. type distributionUtilService interface { getDistributionMethodAndOS() (serverpb.DistributionMethod, pmmv1.DistributionMethod, string) } -// sender is interface which defines method for client which sends report with metrics +// sender is interface which defines method for client which sends report with metrics. type sender interface { SendTelemetry(ctx context.Context, report *reporter.ReportRequest) error } diff --git a/managed/services/telemetry/telemetry.go b/managed/services/telemetry/telemetry.go index 9e9ebdd142..be935063a2 100644 --- a/managed/services/telemetry/telemetry.go +++ b/managed/services/telemetry/telemetry.go @@ -63,7 +63,7 @@ type Service struct { dus distributionUtilService } -// check interfaces +// check interfaces. var ( _ DataSourceLocator = (*Service)(nil) ) @@ -412,7 +412,7 @@ func (s *Service) Format(report *pmmv1.ServerMetric) string { return builder.String() } -// GetSummaries returns the list of gathered telemetry +// GetSummaries returns the list of gathered telemetry. func (s *Service) GetSummaries() []string { result := make([]string, 0, len(s.config.telemetry)) for _, c := range s.config.telemetry { diff --git a/managed/services/types.go b/managed/services/types.go index 2614d4fed2..04720ff2f5 100644 --- a/managed/services/types.go +++ b/managed/services/types.go @@ -66,8 +66,6 @@ func (t *Target) Copy() Target { type CheckResult struct { CheckName string AdvisorName string - Silenced bool - AlertID string Interval check.Interval Target Target Result check.Result diff --git a/managed/services/user/user.go b/managed/services/user/user.go index cf986378a6..0934c93809 100644 --- a/managed/services/user/user.go +++ b/managed/services/user/user.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package user provides API for user related tasks +// Package user provides API for user related tasks. package user import ( @@ -55,7 +55,7 @@ func NewUserService(db *reform.DB, client grafanaClient) *Service { return &s } -// GetUser creates a new user +// GetUser creates a new user. func (s *Service) GetUser(ctx context.Context, _ *userpb.UserDetailsRequest) (*userpb.UserDetailsResponse, error) { userID, err := s.c.GetUserID(ctx) if err != nil { diff --git a/managed/utils/interceptors/grpc_extension.go b/managed/utils/interceptors/grpc_extension.go index 83455c85e5..16b8c4b584 100644 --- a/managed/utils/interceptors/grpc_extension.go +++ b/managed/utils/interceptors/grpc_extension.go @@ -32,7 +32,7 @@ const ( externalCallerOrigin = callerOrigin("external") ) -// GRPCMetricsExtension for extra labels in /debug/metrics +// GRPCMetricsExtension for extra labels in /debug/metrics. type GRPCMetricsExtension struct { grpc_prometheus.DefaultExtension } diff --git a/managed/utils/interceptors/interceptors.go b/managed/utils/interceptors/interceptors.go index 382d30796d..a783a4ab2b 100644 --- a/managed/utils/interceptors/interceptors.go +++ b/managed/utils/interceptors/interceptors.go @@ -142,7 +142,7 @@ func Stream(interceptor grpc.StreamServerInterceptor) func(srv interface{}, ss g } } -// check interfaces +// check interfaces. var ( _ grpc.UnaryServerInterceptor = Unary(nil) _ grpc.StreamServerInterceptor = Stream(nil) diff --git a/managed/utils/irt/metrics.go b/managed/utils/irt/metrics.go index 19c9876ee0..e895325ee4 100644 --- a/managed/utils/irt/metrics.go +++ b/managed/utils/irt/metrics.go @@ -75,7 +75,7 @@ func (m *metrics) Collect(ch chan<- prom.Metric) { m.duration.Collect(ch) } -// check interfaces +// check interfaces. var ( _ prom.Collector = (*metrics)(nil) ) diff --git a/managed/utils/tests/id.go b/managed/utils/tests/id.go index b02ab45804..846a1d9083 100644 --- a/managed/utils/tests/id.go +++ b/managed/utils/tests/id.go @@ -52,7 +52,7 @@ func SetTestIDReader(t *testing.T) { t.Cleanup(func() { uuid.SetRand(nil) }) } -// check interfaces +// check interfaces. var ( _ io.Reader = (*IDReader)(nil) ) diff --git a/qan-api2/models/data_ingestion.go b/qan-api2/models/data_ingestion.go index 126052c9b4..6a8746ccbf 100644 --- a/qan-api2/models/data_ingestion.go +++ b/qan-api2/models/data_ingestion.go @@ -509,7 +509,7 @@ type MetricsBucketExtended struct { *qanpb.MetricsBucket } -// MetricsBucket implements models to store metrics bucket +// MetricsBucket implements models to store metrics bucket. type MetricsBucket struct { db *sqlx.DB l *logrus.Entry @@ -747,7 +747,7 @@ func mapToArrsIntInt(m map[uint64]uint64) ([]uint64, []uint64) { return keys, values } -// check interfaces +// check interfaces. var ( _ prometheus.Collector = (*MetricsBucket)(nil) ) diff --git a/qan-api2/services/analytics/filters_test.go b/qan-api2/services/analytics/filters_test.go index c7afc95c5a..163ffd8c25 100644 --- a/qan-api2/services/analytics/filters_test.go +++ b/qan-api2/services/analytics/filters_test.go @@ -24,7 +24,7 @@ import ( "time" _ "github.com/ClickHouse/clickhouse-go/151" // register database/sql driver - // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated. "github.com/golang/protobuf/ptypes/timestamp" "github.com/jmoiron/sqlx" "github.com/stretchr/testify/assert" diff --git a/qan-api2/services/analytics/object_details_test.go b/qan-api2/services/analytics/object_details_test.go index 6a0173949c..9bc076f37b 100644 --- a/qan-api2/services/analytics/object_details_test.go +++ b/qan-api2/services/analytics/object_details_test.go @@ -21,7 +21,7 @@ import ( "testing" "time" - // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated. "github.com/golang/protobuf/jsonpb" //nolint:staticcheck "github.com/golang/protobuf/ptypes/timestamp" "github.com/stretchr/testify/assert" diff --git a/qan-api2/services/analytics/profile_test.go b/qan-api2/services/analytics/profile_test.go index 429a7c1211..8597d17a93 100644 --- a/qan-api2/services/analytics/profile_test.go +++ b/qan-api2/services/analytics/profile_test.go @@ -23,9 +23,9 @@ import ( "testing" "time" - // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/encoding/protojson' since this one is deprecated. "github.com/golang/protobuf/jsonpb" //nolint:staticcheck - // TODO replace with 'google.golang.org/protobuf/proto' since this one is deprecated + // TODO replace with 'google.golang.org/protobuf/proto' since this one is deprecated. "github.com/golang/protobuf/proto" //nolint:staticcheck "github.com/golang/protobuf/ptypes/timestamp" "github.com/jmoiron/sqlx" diff --git a/qan-api2/utils/interceptors/interceptors.go b/qan-api2/utils/interceptors/interceptors.go index c5aca053fb..d60ef711f8 100644 --- a/qan-api2/utils/interceptors/interceptors.go +++ b/qan-api2/utils/interceptors/interceptors.go @@ -124,7 +124,7 @@ func Stream(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, return err } -// check interfaces +// check interfaces. var ( _ grpc.UnaryServerInterceptor = Unary _ grpc.StreamServerInterceptor = Stream diff --git a/qan-api2/utils/logger/grpc.go b/qan-api2/utils/logger/grpc.go index d658750634..f6e2673182 100644 --- a/qan-api2/utils/logger/grpc.go +++ b/qan-api2/utils/logger/grpc.go @@ -38,7 +38,7 @@ func (v *GRPC) Info(args ...interface{}) { v.Trace(args...) } func (v *GRPC) Infoln(args ...interface{}) { v.Traceln(args...) } func (v *GRPC) Infof(format string, args ...interface{}) { v.Tracef(format, args...) } -// check interfaces +// check interfaces. var ( _ grpclog.LoggerV2 = (*GRPC)(nil) ) diff --git a/qan-api2/utils/logger/logger.go b/qan-api2/utils/logger/logger.go index d51b3cc4f6..45bfe362ef 100644 --- a/qan-api2/utils/logger/logger.go +++ b/qan-api2/utils/logger/logger.go @@ -23,7 +23,7 @@ import ( "github.com/sirupsen/logrus" ) -// key is unexported to prevent collisions - it is different from any other type in other packages +// key is unexported to prevent collisions - it is different from any other type in other packages. var key = struct{}{} // Get returns logrus entry for given context. Set must be called before this method is called. diff --git a/update/ansible/playbook/tasks/roles/grafana/tasks/main.yml b/update/ansible/playbook/tasks/roles/grafana/tasks/main.yml index a617876a55..e212ed109d 100644 --- a/update/ansible/playbook/tasks/roles/grafana/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/grafana/tasks/main.yml @@ -35,7 +35,7 @@ dest: /etc/grafana/grafana.ini section: database option: type - value: absent + state: absent - name: Remove database host ini_file: diff --git a/update/ansible/playbook/tasks/roles/sqlite-to-postgres/tasks/main.yml b/update/ansible/playbook/tasks/roles/sqlite-to-postgres/tasks/main.yml index d8f6b90937..7075c490d8 100644 --- a/update/ansible/playbook/tasks/roles/sqlite-to-postgres/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/sqlite-to-postgres/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: Wait for grafana to update DB and be ready + ansible.builtin.uri: + url: "http://127.0.0.1:3000/api/health" + status_code: 200 + method: GET + retries: 120 + delay: 1 + - name: Create Grafana backup dir file: path: "/srv/backup/grafana" diff --git a/utils/errors/errors.go b/utils/errors/errors.go index 1924f38d88..9550f5843e 100644 --- a/utils/errors/errors.go +++ b/utils/errors/errors.go @@ -15,7 +15,7 @@ // Package errors contains a custom HTTP error handler that adds an extra `Error` field to error payloads. // This helps us maintain compatibility with older PMM clients while keeping the benefits of grpc-gateway v2. -// Our requirement is fairly minimal, but copy a lot of code from grpc-gateway to account for unexported fields and methods +// Our requirement is fairly minimal, but copy a lot of code from grpc-gateway to account for unexported fields and methods. package errors import ( @@ -37,7 +37,7 @@ import ( // PMMHTTPErrorHandler is a custom implementation of DefaultHTTPErrorHandler // (https://github.com/grpc-ecosystem/grpc-gateway/blob/aec6aa29864109e41408491319a859f190ec4040/runtime/errors.go#L93) -// It injects an extra `Error` field in error responses to support old PMM clients +// It injects an extra `Error` field in error responses to support old PMM clients. func PMMHTTPErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error) { // return Internal when Marshal failed const fallback = `{"code": 13, "message": "failed to marshal error message"}` diff --git a/utils/logger/grpc.go b/utils/logger/grpc.go index 15c761c217..1b5c04998d 100644 --- a/utils/logger/grpc.go +++ b/utils/logger/grpc.go @@ -38,7 +38,7 @@ func (v *GRPC) Info(args ...interface{}) { v.Trace(args...) } func (v *GRPC) Infoln(args ...interface{}) { v.Traceln(args...) } func (v *GRPC) Infof(format string, args ...interface{}) { v.Tracef(format, args...) } -// check interfaces +// check interfaces. var ( _ grpclog.LoggerV2 = (*GRPC)(nil) ) diff --git a/utils/logger/logger.go b/utils/logger/logger.go index b47b60f28e..2ff85b60a0 100644 --- a/utils/logger/logger.go +++ b/utils/logger/logger.go @@ -23,7 +23,7 @@ import ( "github.com/sirupsen/logrus" ) -// key is unexported to prevent collisions - it is different from any other type in other packages +// key is unexported to prevent collisions - it is different from any other type in other packages. type key struct{} // Get returns logrus entry for given context. Set must be called before this method is called. diff --git a/utils/nodeinfo/nodeinfo.go b/utils/nodeinfo/nodeinfo.go index 5e0ac2539d..c8ade0b3a2 100644 --- a/utils/nodeinfo/nodeinfo.go +++ b/utils/nodeinfo/nodeinfo.go @@ -68,7 +68,7 @@ func readMachineID() string { return "" } -// TODO remove that completely once we have "zero port" feature +// TODO remove that completely once we have "zero port" feature. func readPublicAddress() string { var res string diff --git a/utils/sqlmetrics/sqlmetrics.go b/utils/sqlmetrics/sqlmetrics.go index 9404cb91c4..3fe412feb3 100644 --- a/utils/sqlmetrics/sqlmetrics.go +++ b/utils/sqlmetrics/sqlmetrics.go @@ -137,7 +137,7 @@ func (c *Collector) Collect(ch chan<- prom.Metric) { float64(stats.MaxLifetimeClosed)) } -// check interfaces +// check interfaces. var ( _ prom.Collector = (*Collector)(nil) ) diff --git a/utils/sqlrows/sqlrows.go b/utils/sqlrows/sqlrows.go index 7255f427c0..35f72a55e0 100644 --- a/utils/sqlrows/sqlrows.go +++ b/utils/sqlrows/sqlrows.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package sqlrows provides helper methods for *sql.Rows +// Package sqlrows provides helper methods for *sql.Rows. package sqlrows import "database/sql" diff --git a/version/release.go b/version/release.go index 1560e45a5d..7e74cfc8df 100644 --- a/version/release.go +++ b/version/release.go @@ -71,7 +71,7 @@ func Time() (time.Time, error) { return time.Unix(sec, 0).UTC(), nil } -// timestampFormatted returns timestamp in format "YYYY-MM-DD HH:mm:ss (UTC)" +// timestampFormatted returns timestamp in format "YYYY-MM-DD HH:mm:ss (UTC)". func timestampFormatted() string { timestamp := Timestamp if t, err := Time(); err == nil { diff --git a/vmproxy/proxy/proxy.go b/vmproxy/proxy/proxy.go index 8fcb9e6683..20fa20f33d 100644 --- a/vmproxy/proxy/proxy.go +++ b/vmproxy/proxy/proxy.go @@ -13,7 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -// Package proxy provides http reverse proxy functionality +// Package proxy provides http reverse proxy functionality. package proxy import ( @@ -30,7 +30,7 @@ import ( "github.com/sirupsen/logrus" ) -// Config defines options for starting proxy +// Config defines options for starting proxy. type Config struct { // Name of the header to check for filters. Case insensitive. HeaderName string