diff --git a/Makefile.include b/Makefile.include index 1db2dcc98e..1c6704b1cf 100644 --- a/Makefile.include +++ b/Makefile.include @@ -139,8 +139,8 @@ api-test: ## Run API tests on dev env. Use `PMM_KUBECONFIG=/path/to/ go test -count=1 -race -p 1 -v ./api-tests/... -pmm.server-insecure-tls check: ## Run required checkers and linters - LOG_LEVEL=error bin/golangci-lint run - bin/go-sumtype ./... + LOG_LEVEL=error bin/golangci-lint run ; \ + bin/go-sumtype ./... ; \ bin/go-consistent -pedantic ./... check-license: ## Run license header checks against source files diff --git a/managed/services/agents/mysql.go b/managed/services/agents/mysql.go index a8381fc8b6..9ed04cb38f 100644 --- a/managed/services/agents/mysql.go +++ b/managed/services/agents/mysql.go @@ -29,6 +29,8 @@ import ( "github.com/percona/pmm/version" ) +var mysqlExporterVersionWithPluginCollector = version.MustParse("2.36.0-0") + // mysqldExporterConfig returns desired configuration of mysqld_exporter process. func mysqldExporterConfig(service *models.Service, exporter *models.Agent, redactMode redactMode, pmmAgentVersion *version.Parsed) *agentpb.SetStateRequest_AgentProcess { tdp := exporter.TemplateDelimiters(service) @@ -65,7 +67,6 @@ func mysqldExporterConfig(service *models.Service, exporter *models.Agent, redac "--collect.custom_query.lr.directory=" + pathsBase(pmmAgentVersion, tdp.Left, tdp.Right) + "/collectors/custom-queries/mysql/low-resolution", "--collect.custom_query.mr.directory=" + pathsBase(pmmAgentVersion, tdp.Left, tdp.Right) + "/collectors/custom-queries/mysql/medium-resolution", "--collect.custom_query.hr.directory=" + pathsBase(pmmAgentVersion, tdp.Left, tdp.Right) + "/collectors/custom-queries/mysql/high-resolution", - "--collect.plugins", "--exporter.max-idle-conns=3", "--exporter.max-open-conns=3", @@ -74,6 +75,11 @@ func mysqldExporterConfig(service *models.Service, exporter *models.Agent, redac "--web.listen-address=:" + tdp.Left + " .listen_port " + tdp.Right, } + if !pmmAgentVersion.Less(mysqlExporterVersionWithPluginCollector) { + args = append(args, + "--collect.plugins") + } + if exporter.IsMySQLTablestatsGroupEnabled() { // keep in sync with Prometheus scrape configs generator tablestatsGroup := []string{ diff --git a/managed/services/agents/mysql_test.go b/managed/services/agents/mysql_test.go index 9a37ce90a1..9b80f23483 100644 --- a/managed/services/agents/mysql_test.go +++ b/managed/services/agents/mysql_test.go @@ -78,7 +78,6 @@ func TestMySQLdExporterConfig(t *testing.T) { "--collect.perf_schema.indexiowaits", "--collect.perf_schema.tableiowaits", "--collect.perf_schema.tablelocks", - "--collect.plugins", "--collect.slave_status", "--collect.standard.go", "--collect.standard.process", @@ -178,7 +177,6 @@ func TestMySQLdExporterConfigTablestatsGroupDisabled(t *testing.T) { "--collect.perf_schema.eventsstatements", "--collect.perf_schema.eventswaits", "--collect.perf_schema.file_events", - "--collect.plugins", "--collect.slave_status", "--collect.standard.go", "--collect.standard.process", @@ -218,6 +216,18 @@ func TestMySQLdExporterConfigTablestatsGroupDisabled(t *testing.T) { actual := mysqldExporterConfig(mysql, exporter, exposeSecrets, pmmAgentVersion) assert.Equal(t, "DATA_SOURCE_NAME=tcp(1.2.3.4:3306)/?timeout=1s&tls=custom", actual.Env[0]) }) + + t.Run("V236_EnablesPluginCollector", func(t *testing.T) { + pmmAgentVersion := version.MustParse("2.36.0") + actual := mysqldExporterConfig(mysql, exporter, exposeSecrets, pmmAgentVersion) + assert.Contains(t, actual.Args, "--collect.plugins") + }) + + t.Run("beforeV236_NoPluginCollector", func(t *testing.T) { + pmmAgentVersion := version.MustParse("2.35.0") + actual := mysqldExporterConfig(mysql, exporter, exposeSecrets, pmmAgentVersion) + assert.NotContains(t, actual.Args, "--collect.plugins") + }) } func TestMySQLdExporterConfigDisabledCollectors(t *testing.T) { @@ -266,7 +276,6 @@ func TestMySQLdExporterConfigDisabledCollectors(t *testing.T) { "--collect.perf_schema.indexiowaits", "--collect.perf_schema.tableiowaits", "--collect.perf_schema.tablelocks", - "--collect.plugins", "--collect.slave_status", "--collect.standard.go", "--collect.standard.process",