Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e0ec222
PMM-7 Fix Makefile.devcontainer usage
maxkondr May 15, 2026
bb77f81
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 15, 2026
9161af8
PMM-7 Fix testifylint linter warnings
maxkondr May 15, 2026
eb4b6f4
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 15, 2026
14987af
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 15, 2026
45cbd2f
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 18, 2026
3d21901
PMM-7 Fix testifylint linter warnings (p2)
maxkondr May 18, 2026
80b5b0e
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 18, 2026
60484a2
fix
maxkondr May 19, 2026
ef9fb5d
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 19, 2026
cdec538
fix
maxkondr May 19, 2026
c2b14ed
fix
maxkondr May 19, 2026
288cf32
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 19, 2026
5c8289c
fix
maxkondr May 19, 2026
03af8ba
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 20, 2026
e6aca31
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 20, 2026
d67473f
PMM-7 Fix intrange linter warnings
maxkondr May 20, 2026
eb25aa0
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 20, 2026
abfa5cd
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 20, 2026
a9536e7
fix
maxkondr May 20, 2026
663fbf9
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 20, 2026
51cd34d
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 21, 2026
c7563b4
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 21, 2026
4efd669
PMM-7 Fix modernize linter warnings
maxkondr May 21, 2026
16d9a32
Update managed/cmd/pmm-managed/main.go
maxkondr May 22, 2026
5b2e263
replace panic with Fatal for func in waitGroup
maxkondr May 22, 2026
fcb4aca
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 22, 2026
0528a5e
PMM-7 Fix staticcheck linter warnings
maxkondr May 22, 2026
20441b4
fix noerrcheck linter warnings
maxkondr May 22, 2026
e081731
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 22, 2026
4bb5383
fix: use res.Err() instead of nil err in BenchmarkCollector
Copilot May 22, 2026
fbcea6b
fix
maxkondr May 22, 2026
9f8637d
fix
maxkondr May 22, 2026
7e43ebf
fix
maxkondr May 22, 2026
d9153ad
fix
maxkondr May 22, 2026
e0d7e9a
PMM-7 Fix prealloc linter warnings
maxkondr May 25, 2026
63f4c69
fix
maxkondr May 25, 2026
9eaca2f
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 26, 2026
77349fc
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 26, 2026
a429d92
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 27, 2026
b69b84a
fix
maxkondr May 27, 2026
fef3c4b
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 27, 2026
bcc22a6
fix
maxkondr May 27, 2026
45a66d6
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 27, 2026
e2b6a48
fix
maxkondr May 27, 2026
f4846ac
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 27, 2026
e191c53
fix
maxkondr May 27, 2026
0a1f6fb
fix
maxkondr May 27, 2026
061ee6d
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 27, 2026
5b59b75
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 28, 2026
3804118
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 28, 2026
aa8e537
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr May 29, 2026
486ab4f
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr May 29, 2026
dd26e56
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr Jun 1, 2026
45b68d9
Merge branch 'v3' into PMM-7-linter-fixes
maxkondr Jun 1, 2026
9a32de1
Merge branch 'PMM-7-linter-fixes' into PMM-7-linter-fixes-2
maxkondr Jun 1, 2026
f5f44da
Merge branch 'v3' into PMM-7-linter-fixes-2
maxkondr Jun 2, 2026
8c121ca
Merge branch 'v3' into PMM-7-linter-fixes-2
maxkondr Jun 2, 2026
d679775
Merge branch 'v3' into PMM-7-linter-fixes-2
maxkondr Jun 3, 2026
b36f957
Update managed/services/victoriametrics/victoriametrics.go
maxkondr Jun 3, 2026
ec54567
Update managed/services/victoriametrics/victoriametrics.go
maxkondr Jun 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions admin/commands/inventory/list_agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,25 @@ func (cmd *ListAgentsCommand) RunCmd() (commands.Result, error) {
return nil, err
}

var agentsList []listResultAgent //nolint:prealloc
agentsList := make(
[]listResultAgent, 0,
len(agentsRes.Payload.PMMAgent)+
len(agentsRes.Payload.NodeExporter)+
len(agentsRes.Payload.MysqldExporter)+
len(agentsRes.Payload.MongodbExporter)+
len(agentsRes.Payload.PostgresExporter)+
len(agentsRes.Payload.ValkeyExporter)+
len(agentsRes.Payload.ProxysqlExporter)+
len(agentsRes.Payload.RDSExporter)+
len(agentsRes.Payload.QANMysqlPerfschemaAgent)+
len(agentsRes.Payload.QANMysqlSlowlogAgent)+
len(agentsRes.Payload.QANMongodbProfilerAgent)+
len(agentsRes.Payload.QANMongodbMongologAgent)+
len(agentsRes.Payload.QANPostgresqlPgstatementsAgent)+
len(agentsRes.Payload.QANPostgresqlPgstatmonitorAgent)+
len(agentsRes.Payload.ExternalExporter)+
len(agentsRes.Payload.RtaMongodbAgent),
)
for _, a := range agentsRes.Payload.PMMAgent {
status := "disconnected"
if a.Connected {
Expand Down Expand Up @@ -241,6 +259,16 @@ func (cmd *ListAgentsCommand) RunCmd() (commands.Result, error) {
Disabled: a.Disabled,
})
}
for _, a := range agentsRes.Payload.QANMongodbMongologAgent {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like a bugfix, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, it was missed in response

agentsList = append(agentsList, listResultAgent{
AgentType: types.AgentTypeQANMongoDBMongologAgent,
AgentID: a.AgentID,
PMMAgentID: a.PMMAgentID,
ServiceID: a.ServiceID,
Status: getAgentStatus(a.Status),
Disabled: a.Disabled,
})
}
for _, a := range agentsRes.Payload.QANPostgresqlPgstatementsAgent {
agentsList = append(agentsList, listResultAgent{
AgentType: types.AgentTypeQANPostgreSQLPgStatementsAgent,
Expand Down Expand Up @@ -271,7 +299,6 @@ func (cmd *ListAgentsCommand) RunCmd() (commands.Result, error) {
Port: a.ListenPort,
})
}

for _, a := range agentsRes.Payload.RtaMongodbAgent {
agentsList = append(agentsList, listResultAgent{
AgentType: types.AgentTypeRTAMongoDBAgent,
Expand Down
9 changes: 8 additions & 1 deletion admin/commands/inventory/list_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ func (cmd *ListServicesCommand) RunCmd() (commands.Result, error) {
return net.JoinHostPort(address, strconv.FormatInt(port, 10))
}

var servicesList []listResultService //nolint:prealloc
servicesList := make([]listResultService, 0,
len(result.Payload.Mysql)+
len(result.Payload.Mongodb)+
len(result.Payload.Postgresql)+
len(result.Payload.Valkey)+
len(result.Payload.Proxysql)+
len(result.Payload.Haproxy)+
len(result.Payload.External))
for _, s := range result.Payload.Mysql {
servicesList = append(servicesList, listResultService{
ServiceType: types.ServiceTypeMySQLService,
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ func getMetricsMode(s bool) string {
}

func agentsList(agentsRes *agents.ListAgentsOK, nodeID string) []listResultAgent {
pmmAgentIDs := make(map[string]struct{})
agentsList := []listResultAgent{}
pmmAgentIDs := make(map[string]struct{}, len(agentsRes.Payload.PMMAgent))
agentsList := make([]listResultAgent, 0, len(agentsRes.Payload.PMMAgent))

agentsList = append(agentsList, pmmAgents(agentsRes, nodeID, pmmAgentIDs)...)
agentsList = append(agentsList, nodeExporters(agentsRes, pmmAgentIDs)...)
Expand Down
6 changes: 3 additions & 3 deletions agent/agents/mongodb/mongolog/internal/monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func testFileNames(t *testing.T) ([]string, error) {
return nil, err
}

var names []string //nolint:prealloc
names := make([]string, 0, len(files))
for _, file := range files {
if file.IsDir() {
continue
Expand All @@ -171,7 +171,7 @@ func testFileNames(t *testing.T) ([]string, error) {
func reorderData(t *testing.T, data []proto.SystemProfile) []proto.SystemProfile {
t.Helper()

var res []proto.SystemProfile //nolint:prealloc
res := make([]proto.SystemProfile, 0, len(data))
for _, d := range data {
d.Ts = d.Ts.UTC()

Expand All @@ -189,7 +189,7 @@ func reorderData(t *testing.T, data []proto.SystemProfile) []proto.SystemProfile
func reorderBSOND(t *testing.T, data bson.D) bson.D {
t.Helper()

var res []bson.E //nolint:prealloc
res := make([]bson.E, 0, len(data))
for _, d := range data {
res = append(res, d)
}
Expand Down
2 changes: 1 addition & 1 deletion agent/agents/mongodb/profiler/internal/profiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func testProfiler(t *testing.T, url string) {
responseLength := float32(45)

assert.Len(t, bucketsMap, dbsCount) // 300 sample docs / 10 = different database names
var buckets []*agentv1.MetricsBucket
buckets := make([]*agentv1.MetricsBucket, 0, len(bucketsMap))
for _, bucket := range bucketsMap {
buckets = append(buckets, bucket)
}
Expand Down
2 changes: 1 addition & 1 deletion agent/agents/mongodb/shared/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (a *Aggregator) newInterval(ts time.Time) {
func (a *Aggregator) createResult(_ context.Context) *report.Result {
queries := a.mongostats.Queries()
queryStats := queries.CalcQueriesStats(int64(DefaultInterval))
var buckets []*agentv1.MetricsBucket //nolint:prealloc
buckets := make([]*agentv1.MetricsBucket, 0, len(queryStats))

a.logger.Tracef("Queries: %#v", queries)
a.logger.Tracef("Query Stats: %#v", queryStats)
Expand Down
2 changes: 1 addition & 1 deletion agent/agents/postgres/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ var extractTablesRecover = true
// ExtractTables extracts table names from query.
func ExtractTables(query string) ([]string, error) {
var err error
var tables []string //nolint:prealloc

if extractTablesRecover {
defer func() {
Expand Down Expand Up @@ -64,6 +63,7 @@ func ExtractTables(query string) ([]string, error) {
delete(tableNames, v)
}

tables := make([]string, 0, len(tableNames))
for k := range tableNames {
tables = append(tables, k)
}
Expand Down
2 changes: 1 addition & 1 deletion agent/agents/postgres/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestExtractTables(t *testing.T) {
t.Parallel()

actual, err := f(query)
assert.Equal(t, expected.Tables, actual)
assert.ElementsMatch(t, expected.Tables, actual)
if expected.Err != "" {
require.EqualError(t, err, expected.Err, "err = %+v", err)
} else {
Expand Down
19 changes: 18 additions & 1 deletion api-tests/management/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,21 @@ func removeAllAgentsInList(t *testing.T, listAgentsOK *agents.ListAgentsOK) {
require.NotNil(t, listAgentsOK)
require.NotNil(t, listAgentsOK.Payload)

var agentIDs []string //nolint:prealloc
agentIDs := make([]string, 0,
len(listAgentsOK.Payload.NodeExporter)+
len(listAgentsOK.Payload.PMMAgent)+
len(listAgentsOK.Payload.PostgresExporter)+
len(listAgentsOK.Payload.MysqldExporter)+
len(listAgentsOK.Payload.ProxysqlExporter)+
len(listAgentsOK.Payload.QANMysqlPerfschemaAgent)+
len(listAgentsOK.Payload.MongodbExporter)+
len(listAgentsOK.Payload.QANMongodbProfilerAgent)+
len(listAgentsOK.Payload.QANMongodbMongologAgent)+
len(listAgentsOK.Payload.QANMysqlSlowlogAgent)+
len(listAgentsOK.Payload.QANPostgresqlPgstatementsAgent)+
len(listAgentsOK.Payload.ExternalExporter)+
len(listAgentsOK.Payload.VMAgent)+
len(listAgentsOK.Payload.RtaMongodbAgent))
for _, agent := range listAgentsOK.Payload.NodeExporter {
agentIDs = append(agentIDs, agent.AgentID)
}
Expand Down Expand Up @@ -181,6 +195,9 @@ func removeAllAgentsInList(t *testing.T, listAgentsOK *agents.ListAgentsOK) {
for _, agent := range listAgentsOK.Payload.VMAgent {
agentIDs = append(agentIDs, agent.AgentID)
}
for _, agent := range listAgentsOK.Payload.RtaMongodbAgent {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, it was missed

agentIDs = append(agentIDs, agent.AgentID)
}

pmmapitests.RemoveAgents(t, agentIDs...)
}
5 changes: 2 additions & 3 deletions managed/services/agents/vmagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ func vmAgentConfig(scrapeCfg string, params victoriaMetricsParams) *agentv1.SetS
interfaceToBind := envvars.GetInterfaceToBind()

// Only keep the specified exceptions as command line arguments
args := []string{
args := append([]string{
"-envflag.enable=true",
"-envflag.prefix=VMAGENT_",
"-remoteWrite.tmpDataPath={{.tmp_dir}}/vmagent-temp-dir",
"-promscrape.config={{.TextFiles.vmagentscrapecfg}}",
"-httpListenAddr=" + interfaceToBind + ":{{.listen_port}}",
}
args = append(args, params.VMAgentArgs()...)
}, params.VMAgentArgs()...)

sort.Strings(args)

Expand Down
6 changes: 4 additions & 2 deletions managed/services/management/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ func (s *MgmtServices) RemoveScheduledTasks(ctx context.Context, db *reform.DB,
return err
}

allServices := append(servicesInCurrentCluster, servicesInNewCluster...) //nolint:gocritic
allServices := make([]*models.Service, 0, len(servicesInCurrentCluster)+len(servicesInNewCluster)+1)
allServices = append(allServices, servicesInCurrentCluster...)
allServices = append(allServices, servicesInNewCluster...)
allServices = append(allServices, service)

sMap := make(map[string]struct{})
sMap := make(map[string]struct{}, len(allServices))
for _, service := range allServices {
sMap[service.ServiceID] = struct{}{}
}
Expand Down
2 changes: 1 addition & 1 deletion managed/services/management/rds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ func TestRDSService(t *testing.T) {
opts := []func(*config.LoadOptions) error{
config.WithCredentialsProvider(creds),
config.WithHTTPClient(&http.Client{}),
config.WithClientLogMode(aws.LogRetries | aws.LogRequestWithBody | aws.LogResponseWithBody),
}
opts = append(opts, config.WithClientLogMode(aws.LogRetries|aws.LogRequestWithBody|aws.LogResponseWithBody))
cfg, err := config.LoadDefaultConfig(ctx, opts...)
require.NoError(t, err)

Expand Down
2 changes: 1 addition & 1 deletion managed/services/telemetry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (c *ServiceConfig) Init(l *logrus.Entry) error {
}

func (c *ServiceConfig) loadMetricsConfig(configFile string) ([]Config, error) {
var fileConfigs []FileConfig
fileConfigs := make([]FileConfig, 0, 1)
var fileCfg FileConfig

var config []byte
Expand Down
6 changes: 4 additions & 2 deletions managed/services/victoriametrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,13 @@ func AddScrapeConfigs(l *logrus.Entry, cfg *config.Config, q *reform.Querier, //

// AddInternalServicesToScrape adds internal services metrics to scrape targets.
func addInternalServicesToScrape(s models.MetricsResolutions, svc *Service, pmmServerNodeName string) []*config.ScrapeConfig {
cfg := []*config.ScrapeConfig{
cfg := make([]*config.ScrapeConfig, 0, 4) //nolint:mnd
cfg = append(
cfg,
scrapeConfigForGrafana(s.MR, pmmServerNodeName),
scrapeConfigForPMMManaged(s.MR, pmmServerNodeName),
scrapeConfigForQANAPI2(s.MR, pmmServerNodeName),
}
)

if svc.params.ExternalVM() {
return cfg
Expand Down
17 changes: 12 additions & 5 deletions managed/services/victoriametrics/victoriametrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,22 @@ func (svc *Service) validateConfig(ctx context.Context, cfg []byte) error {
if err != nil {
return err
}
defer func() {
err = f.Close()
if err != nil {
svc.l.Debug(err)
}
err = os.Remove(f.Name())
if err != nil {
svc.l.Debug(err)
}
}()
if _, err = f.Write(cfg); err != nil {
return err
}
defer func() {
_ = f.Close()
_ = os.Remove(f.Name())
}()

args := []string{"-promscrape.config.dryRun=true", "-promscrape.config", f.Name()}
args := make([]string, 0, 4) //nolint:mnd
args = append(args, "-promscrape.config.dryRun=true", "-promscrape.config", f.Name())
cmd := exec.CommandContext(ctx, "victoriametrics", args...) //nolint:gosec
pdeathsig.Set(cmd, unix.SIGKILL)

Expand Down
2 changes: 1 addition & 1 deletion managed/utils/encryption/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func decryptColumnStringHandler(e *Encryption, val any) (any, error) {
}

func (table Table) columnsList() []string {
res := []string{}
res := make([]string, 0, len(table.Columns))
for _, c := range table.Columns {
res = append(res, c.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion qan-api2/models/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ func (m *Metrics) GetSelectedQueryMetadata(ctx context.Context, periodStartFromS
}

func prepareMetadataProperty(metadata map[string]struct{}) string {
res := []string{}
res := make([]string, 0, len(metadata))
for k := range metadata {
res = append(res, k)
}
Expand Down
2 changes: 1 addition & 1 deletion qan-api2/services/analytics/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *Service) GetReport(ctx context.Context, in *qanpb.GetReportRequest) (*q
labels[label.Key] = label.Value
}

var columns []string //nolint:prealloc
columns := make([]string, 0, len(in.Columns))
for _, col := range in.Columns {
// TODO: remove when UI starts using num_queries instead.
if col == "count" {
Expand Down
2 changes: 1 addition & 1 deletion qan-api2/services/analytics/profile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ func TestService_GetReport_AllLabels(t *testing.T) {
}

genDimensionvalues := func(dimKey string, amount int) []string {
arr := []string{}
arr := make([]string, 0, amount)
for i := range amount {
arr = append(arr, fmt.Sprintf("%s%d", dimKey, i))
}
Expand Down
Loading