From 6b1090dd06b6c0c8145992eabbcc3665c20810e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:03:15 +0300 Subject: [PATCH 1/2] Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (#2507) Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.16.0 to 1.17.0. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/v1.17.0/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.16.0...v1.17.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 1c1e5169d3..9df113a911 100644 --- a/go.mod +++ b/go.mod @@ -65,7 +65,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.0 github.com/prometheus/alertmanager v0.26.0 - github.com/prometheus/client_golang v1.16.0 + github.com/prometheus/client_golang v1.17.0 github.com/prometheus/common v0.44.0 github.com/ramr/go-reaper v0.2.1 github.com/robfig/cron/v3 v3.0.1 @@ -236,10 +236,10 @@ require ( github.com/paulmach/orb v0.10.0 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - github.com/prometheus/client_model v0.4.0 // indirect + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect github.com/prometheus/exporter-toolkit v0.10.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/prometheus/procfs v0.11.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rs/xid v1.5.0 // indirect github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect diff --git a/go.sum b/go.sum index ede50cba68..4f618ea85f 100644 --- a/go.sum +++ b/go.sum @@ -680,14 +680,14 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= @@ -705,8 +705,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/ramr/go-reaper v0.2.1 h1:zww+wlQOvTjBZuk1920R/e0GFEb6O7+B0WQLV6dM924= github.com/ramr/go-reaper v0.2.1/go.mod h1:AVypdzrcCXjSc/JYnlXl8TsB+z84WyFzxWE8Jh0MOJc= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= From d9e58e1ee59212bb4a4dfa50ecf0003a1b07d852 Mon Sep 17 00:00:00 2001 From: Alex Tymchuk Date: Thu, 28 Sep 2023 20:32:30 +0300 Subject: [PATCH 2/2] PMM-12547 Revert PMM-11670 Set the cluster label if empty (#2508) * Revert "PMM-11670 Set the cluster label if empty (#2459)" This reverts commit 3c58ed956b5ae6b19a621d7d4cd12087051abd62. * PMM-12547 use a different IP * PMM-12547 fix the debug command in actions --- api-tests/inventory/nodes_test.go | 5 ++- api-tests/inventory/services_test.go | 12 ------- api-tests/management/external_test.go | 2 -- api-tests/management/haproxy_test.go | 2 -- api-tests/management/mongodb_test.go | 7 ---- api-tests/management/mysql_test.go | 6 ---- api-tests/management/postgresql_test.go | 7 ---- api-tests/management/proxysql_test.go | 16 ++++----- managed/models/database.go | 3 -- managed/models/service_helpers_test.go | 33 +++++++------------ managed/models/service_model.go | 6 ---- managed/services/inventory/services_test.go | 10 ------ managed/services/qan/client_test.go | 4 --- .../victoriametrics/victoriametrics_test.go | 12 ------- 14 files changed, 21 insertions(+), 104 deletions(-) diff --git a/api-tests/inventory/nodes_test.go b/api-tests/inventory/nodes_test.go index fe7e3142ec..6cd3d5c466 100644 --- a/api-tests/inventory/nodes_test.go +++ b/api-tests/inventory/nodes_test.go @@ -353,7 +353,7 @@ func TestContainerNodeDeprecated(t *testing.T) { ContainerID: "docker-id", ContainerName: "docker-name", MachineID: "machine-id", - Address: "10.10.1.10", + Address: "10.10.1.11", }, Context: pmmapitests.Context, } @@ -377,7 +377,7 @@ func TestContainerNodeDeprecated(t *testing.T) { ContainerID: "docker-id", ContainerName: "docker-name", MachineID: "machine-id", - Address: "10.10.1.10", + Address: "10.10.1.11", }, }, } @@ -688,7 +688,6 @@ func TestRemoveNode(t *testing.T) { Address: "localhost", Port: 3306, ServiceName: serviceName, - Cluster: serviceName, }, }, }, listAgentsOK.Payload) diff --git a/api-tests/inventory/services_test.go b/api-tests/inventory/services_test.go index d019fb0f46..ae0ae00521 100644 --- a/api-tests/inventory/services_test.go +++ b/api-tests/inventory/services_test.go @@ -352,7 +352,6 @@ func TestMySQLService(t *testing.T) { Address: "localhost", Port: 3306, ServiceName: serviceName, - Cluster: serviceName, }, }, }, res) @@ -373,7 +372,6 @@ func TestMySQLService(t *testing.T) { Address: "localhost", Port: 3306, ServiceName: serviceName, - Cluster: serviceName, }, }, }, serviceRes) @@ -555,7 +553,6 @@ func TestMongoDBService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "localhost", Port: 27017, }, @@ -576,7 +573,6 @@ func TestMongoDBService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "localhost", Port: 27017, }, @@ -733,7 +729,6 @@ func TestMongoDBService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, - Cluster: serviceName, Socket: "/tmp/mongodb-27017.sock", }, }, @@ -775,7 +770,6 @@ func TestPostgreSQLService(t *testing.T) { DatabaseName: defaultPostgresDBName, Port: 5432, ServiceName: serviceName, - Cluster: serviceName, }, }, }, res) @@ -797,7 +791,6 @@ func TestPostgreSQLService(t *testing.T) { DatabaseName: defaultPostgresDBName, Port: 5432, ServiceName: serviceName, - Cluster: serviceName, }, }, }, serviceRes) @@ -980,7 +973,6 @@ func TestProxySQLService(t *testing.T) { Address: "localhost", Port: 5432, ServiceName: serviceName, - Cluster: serviceName, }, }, }, res) @@ -1001,7 +993,6 @@ func TestProxySQLService(t *testing.T) { Address: "localhost", Port: 5432, ServiceName: serviceName, - Cluster: serviceName, }, }, }, serviceRes) @@ -1193,7 +1184,6 @@ func TestExternalService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, - Cluster: serviceName, Group: "redis", }, }, @@ -1213,7 +1203,6 @@ func TestExternalService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, - Cluster: serviceName, Group: "redis", }, }, @@ -1345,7 +1334,6 @@ func TestExternalService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, - Cluster: serviceName, Group: "external", }, }, diff --git a/api-tests/management/external_test.go b/api-tests/management/external_test.go index c044ee654b..289466ff0f 100644 --- a/api-tests/management/external_test.go +++ b/api-tests/management/external_test.go @@ -74,7 +74,6 @@ func TestAddExternal(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Group: "external", }, }, *serviceOK.Payload) @@ -226,7 +225,6 @@ func TestAddExternal(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Group: "external", }, }, *serviceOK.Payload) diff --git a/api-tests/management/haproxy_test.go b/api-tests/management/haproxy_test.go index ceaa2bc147..7b25a0103e 100644 --- a/api-tests/management/haproxy_test.go +++ b/api-tests/management/haproxy_test.go @@ -76,7 +76,6 @@ func TestAddHAProxy(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, }, }, *serviceOK.Payload) @@ -226,7 +225,6 @@ func TestAddHAProxy(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, }, }, *serviceOK.Payload) diff --git a/api-tests/management/mongodb_test.go b/api-tests/management/mongodb_test.go index 75c6623fb9..17472529af 100644 --- a/api-tests/management/mongodb_test.go +++ b/api-tests/management/mongodb_test.go @@ -79,7 +79,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -155,7 +154,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -391,7 +389,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -610,7 +607,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Socket: "/tmp/mongodb-27017.sock", }, }, *serviceOK.Payload) @@ -682,7 +678,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -755,7 +750,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -827,7 +821,6 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, diff --git a/api-tests/management/mysql_test.go b/api-tests/management/mysql_test.go index 5f7490183c..a80f8dc3e3 100644 --- a/api-tests/management/mysql_test.go +++ b/api-tests/management/mysql_test.go @@ -80,7 +80,6 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -160,7 +159,6 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -415,7 +413,6 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -669,7 +666,6 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -745,7 +741,6 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -820,7 +815,6 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, diff --git a/api-tests/management/postgresql_test.go b/api-tests/management/postgresql_test.go index 9e575730f2..4b7876cd94 100644 --- a/api-tests/management/postgresql_test.go +++ b/api-tests/management/postgresql_test.go @@ -82,7 +82,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -162,7 +161,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -263,7 +261,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -413,7 +410,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 27017, @@ -640,7 +636,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -716,7 +711,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -791,7 +785,6 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, diff --git a/api-tests/management/proxysql_test.go b/api-tests/management/proxysql_test.go index 907987abe9..e7bc9cd594 100644 --- a/api-tests/management/proxysql_test.go +++ b/api-tests/management/proxysql_test.go @@ -80,7 +80,6 @@ func TestAddProxySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -156,7 +155,6 @@ func TestAddProxySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -262,12 +260,13 @@ func TestAddProxySQL(t *testing.T) { params := &proxysql.AddProxySQLParams{ Context: pmmapitests.Context, Body: proxysql.AddProxySQLBody{ - NodeID: nodeID, - PMMAgentID: pmmAgentID, - ServiceName: serviceName, - Address: "10.10.10.10", - Port: 3306, - Username: "username", + NodeID: nodeID, + PMMAgentID: pmmAgentID, + ServiceName: serviceName, + Address: "10.10.10.10", + Port: 3306, + Username: "username", + SkipConnectionCheck: true, }, } @@ -387,7 +386,6 @@ func TestAddProxySQL(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, - Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, diff --git a/managed/models/database.go b/managed/models/database.go index 189037f922..0ce9add0ca 100644 --- a/managed/models/database.go +++ b/managed/models/database.go @@ -915,9 +915,6 @@ var databaseSchema = [][]string{ `ALTER TABLE agents ALTER COLUMN comments_parsing_disabled DROP DEFAULT`, }, - 85: { - `UPDATE services SET cluster = service_name WHERE cluster = ''`, - }, } // ^^^ Avoid default values in schema definition. ^^^ diff --git a/managed/models/service_helpers_test.go b/managed/models/service_helpers_test.go index 47d4dc317c..c3076809b2 100644 --- a/managed/models/service_helpers_test.go +++ b/managed/models/service_helpers_test.go @@ -158,11 +158,10 @@ func TestServiceHelpers(t *testing.T) { services, err = models.FindServices(q, models.ServiceFilters{NodeID: "N1"}) assert.NoError(t, err) assert.Equal(t, 3, len(services)) - assert.Equal(t, []*models.Service{{ + assert.Equal(t, services, []*models.Service{{ ServiceID: "S1", ServiceType: models.MongoDBServiceType, ServiceName: "Service without Agents", - Cluster: "Service without Agents", NodeID: "N1", Address: pointer.ToString("127.0.0.1"), Port: pointer.ToUint16OrNil(27017), @@ -172,7 +171,6 @@ func TestServiceHelpers(t *testing.T) { ServiceID: "S2", ServiceType: models.MySQLServiceType, ServiceName: "Service with Agents", - Cluster: "Service with Agents", NodeID: "N1", Address: pointer.ToString("127.0.0.1"), Port: pointer.ToUint16OrNil(3306), @@ -182,38 +180,35 @@ func TestServiceHelpers(t *testing.T) { ServiceID: "S5", ServiceType: models.ProxySQLServiceType, ServiceName: "Fifth service", - Cluster: "Fifth service", NodeID: "N1", Address: pointer.ToString("127.0.0.1"), Port: pointer.ToUint16OrNil(6032), CreatedAt: now, UpdatedAt: now, - }}, services) + }}) services, err = models.FindServices(q, models.ServiceFilters{NodeID: "N1", ServiceType: pointerToServiceType(models.MySQLServiceType)}) assert.NoError(t, err) assert.Equal(t, 1, len(services)) - assert.Equal(t, []*models.Service{{ + assert.Equal(t, services, []*models.Service{{ ServiceID: "S2", ServiceType: models.MySQLServiceType, ServiceName: "Service with Agents", - Cluster: "Service with Agents", NodeID: "N1", Address: pointer.ToString("127.0.0.1"), Port: pointer.ToUint16OrNil(3306), CreatedAt: now, UpdatedAt: now, - }}, services) + }}) services, err = models.FindServices(q, models.ServiceFilters{NodeID: "N2", ServiceType: pointerToServiceType(models.ExternalServiceType)}) assert.NoError(t, err) assert.Equal(t, 2, len(services)) - assert.Equal(t, []*models.Service{ + assert.Equal(t, services, []*models.Service{ { ServiceID: "S4", ServiceType: models.ExternalServiceType, ServiceName: "Fourth service", - Cluster: "Fourth service", ExternalGroup: "external", NodeID: "N2", CreatedAt: now, @@ -223,7 +218,6 @@ func TestServiceHelpers(t *testing.T) { ServiceID: "S7", ServiceType: models.ExternalServiceType, ServiceName: "Seventh service", - Cluster: "Seventh service", NodeID: "N2", Address: pointer.ToString("127.0.0.1"), Port: pointer.ToUint16OrNil(6379), @@ -231,50 +225,47 @@ func TestServiceHelpers(t *testing.T) { CreatedAt: now, UpdatedAt: now, }, - }, services) + }) services, err = models.FindServices(q, models.ServiceFilters{NodeID: "N2", ServiceType: pointerToServiceType(models.ProxySQLServiceType)}) assert.NoError(t, err) assert.Equal(t, 1, len(services)) - assert.Equal(t, []*models.Service{{ + assert.Equal(t, services, []*models.Service{{ ServiceID: "S6", ServiceType: models.ProxySQLServiceType, ServiceName: "Sixth service", - Cluster: "Sixth service", Socket: pointer.ToStringOrNil("/tmp/proxysql_admin.sock"), NodeID: "N2", CreatedAt: now, UpdatedAt: now, - }}, services) + }}) services, err = models.FindServices(q, models.ServiceFilters{ExternalGroup: "redis"}) assert.NoError(t, err) assert.Equal(t, 1, len(services)) - assert.Equal(t, []*models.Service{{ + assert.Equal(t, services, []*models.Service{{ ServiceID: "S7", ServiceType: models.ExternalServiceType, ServiceName: "Seventh service", - Cluster: "Seventh service", NodeID: "N2", Address: pointer.ToString("127.0.0.1"), Port: pointer.ToUint16OrNil(6379), ExternalGroup: "redis", CreatedAt: now, UpdatedAt: now, - }}, services) + }}) services, err = models.FindServices(q, models.ServiceFilters{NodeID: "N2", ServiceType: pointerToServiceType(models.HAProxyServiceType)}) assert.NoError(t, err) assert.Equal(t, 1, len(services)) - assert.Equal(t, []*models.Service{{ + assert.Equal(t, services, []*models.Service{{ ServiceID: "S8", ServiceType: models.HAProxyServiceType, ServiceName: "Eighth service", - Cluster: "Eighth service", NodeID: "N2", CreatedAt: now, UpdatedAt: now, - }}, services) + }}) }) t.Run("FindActiveServiceTypes", func(t *testing.T) { diff --git a/managed/models/service_model.go b/managed/models/service_model.go index 04c7484156..3842f9a808 100644 --- a/managed/models/service_model.go +++ b/managed/models/service_model.go @@ -74,9 +74,6 @@ func (s *Service) BeforeInsert() error { if len(s.CustomLabels) == 0 { s.CustomLabels = nil } - if s.Cluster == "" { - s.Cluster = s.ServiceName - } return nil } @@ -86,9 +83,6 @@ func (s *Service) BeforeUpdate() error { if len(s.CustomLabels) == 0 { s.CustomLabels = nil } - if s.Cluster == "" { - s.Cluster = s.ServiceName - } return nil } diff --git a/managed/services/inventory/services_test.go b/managed/services/inventory/services_test.go index 40f0d75d0b..3d091d7091 100644 --- a/managed/services/inventory/services_test.go +++ b/managed/services/inventory/services_test.go @@ -104,7 +104,6 @@ func TestServices(t *testing.T) { expectedService := &inventorypb.MySQLService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-mysql", - Cluster: "test-mysql", NodeId: models.PMMServerNodeID, Address: "127.0.0.1", Port: 3306, @@ -260,7 +259,6 @@ func TestServices(t *testing.T) { expectedService := &inventorypb.MySQLService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-mysql-socket", - Cluster: "test-mysql-socket", NodeId: models.PMMServerNodeID, Socket: "/var/run/mysqld/mysqld.sock", } @@ -335,7 +333,6 @@ func TestServices(t *testing.T) { expectedMongoDBService := &inventorypb.MongoDBService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-mongo", - Cluster: "test-mongo", NodeId: models.PMMServerNodeID, Address: "127.0.0.1", Port: 27017, @@ -377,7 +374,6 @@ func TestServices(t *testing.T) { expectedPostgreSQLService := &inventorypb.PostgreSQLService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-postgres", - Cluster: "test-postgres", DatabaseName: "postgres", NodeId: models.PMMServerNodeID, Address: "127.0.0.1", @@ -418,7 +414,6 @@ func TestServices(t *testing.T) { expectedPostgreSQLService := &inventorypb.PostgreSQLService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-postgres", - Cluster: "test-postgres", DatabaseName: "postgres", NodeId: models.PMMServerNodeID, Socket: "/var/run/postgresql", @@ -497,7 +492,6 @@ func TestServices(t *testing.T) { expectedProxySQLService := &inventorypb.ProxySQLService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-proxysql", - Cluster: "test-proxysql", NodeId: models.PMMServerNodeID, Address: "127.0.0.1", Port: 6033, @@ -537,7 +531,6 @@ func TestServices(t *testing.T) { expectedService := &inventorypb.ProxySQLService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-proxysql-socket", - Cluster: "test-proxysql-socket", NodeId: models.PMMServerNodeID, Socket: "/tmp/proxysql.sock", } @@ -609,7 +602,6 @@ func TestServices(t *testing.T) { expectedHAProxyService := &inventorypb.HAProxyService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-haproxy-service", - Cluster: "test-haproxy-service", NodeId: models.PMMServerNodeID, } assert.Equal(t, expectedHAProxyService, actualHAProxyService) @@ -647,7 +639,6 @@ func TestServices(t *testing.T) { expectedExternalService := &inventorypb.ExternalService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-external-service", - Cluster: "test-external-service", NodeId: models.PMMServerNodeID, Group: "external", } @@ -739,7 +730,6 @@ func TestServices(t *testing.T) { expectedService := &inventorypb.MongoDBService{ ServiceId: "/service_id/00000000-0000-4000-8000-000000000005", ServiceName: "test-mongodb-socket", - Cluster: "test-mongodb-socket", NodeId: models.PMMServerNodeID, Socket: "/tmp/mongodb-27017.sock", } diff --git a/managed/services/qan/client_test.go b/managed/services/qan/client_test.go index dce12fce95..700840abd2 100644 --- a/managed/services/qan/client_test.go +++ b/managed/services/qan/client_test.go @@ -185,7 +185,6 @@ func TestClient(t *testing.T) { MQueryTimeSum: 1234, ServiceId: "/service_id/014647c3-b2f5-44eb-94f4-d943260a968c", ServiceName: "test-mysql", - Cluster: "test-mysql", ServiceType: "mysql", NodeId: "/node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d", NodeName: "test-generic-node", @@ -255,7 +254,6 @@ func TestClient(t *testing.T) { NumQueries: 1, ServiceId: "/service_id/1fce2502-ecc7-46d4-968b-18d7907f2543", ServiceName: "test-mongodb", - Cluster: "test-mongodb", ServiceType: "mongodb", NodeId: "/node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d", NodeName: "test-generic-node", @@ -354,7 +352,6 @@ func TestClient(t *testing.T) { MQueryTimeCnt: 1, MQueryTimeSum: 55, ServiceName: "test-postgresql", - Cluster: "test-postgresql", ServiceType: "postgresql", ServiceId: "/service_id/9cffbdd4-3cd2-47f8-a5f9-a749c3d5fee1", NodeId: "/node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d", @@ -495,7 +492,6 @@ func TestClientPerformance(t *testing.T) { expectedBuckets[i] = &qanpb.MetricsBucket{ Queryid: fmt.Sprintf("bucket %d", i), ServiceName: "test-mysql", - Cluster: "test-mysql", NodeId: "pmm-server", NodeName: "pmm-server", NodeType: "generic", diff --git a/managed/services/victoriametrics/victoriametrics_test.go b/managed/services/victoriametrics/victoriametrics_test.go index d6a7db56cb..413afcf5f2 100644 --- a/managed/services/victoriametrics/victoriametrics_test.go +++ b/managed/services/victoriametrics/victoriametrics_test.go @@ -337,7 +337,6 @@ scrape_configs: _service_label: bam agent_id: /agent_id/cfec996c-4fe6-41d9-83cb-e1a3b1fe10a8 agent_type: mongodb_exporter - cluster: test-mongodb-noversion instance: /agent_id/cfec996c-4fe6-41d9-83cb-e1a3b1fe10a8 node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -368,7 +367,6 @@ scrape_configs: _service_label: bam agent_id: /agent_id/ecd8995a-d479-4b4d-bfb7-865bac4ac2fb agent_type: mongodb_exporter - cluster: test-mongodb instance: /agent_id/ecd8995a-d479-4b4d-bfb7-865bac4ac2fb node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -399,7 +397,6 @@ scrape_configs: _service_label: bam agent_id: /agent_id/ecd8995a-d479-4b4d-bfb7-865bac4ac2fb agent_type: mongodb_exporter - cluster: test-mongodb instance: /agent_id/ecd8995a-d479-4b4d-bfb7-865bac4ac2fb node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -432,7 +429,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/75bb30d3-ef4a-4147-97a8-621a996611dd agent_type: mysqld_exporter - cluster: test-mysql instance: /agent_id/75bb30d3-ef4a-4147-97a8-621a996611dd node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -470,7 +466,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/75bb30d3-ef4a-4147-97a8-621a996611dd agent_type: mysqld_exporter - cluster: test-mysql instance: /agent_id/75bb30d3-ef4a-4147-97a8-621a996611dd node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -514,7 +509,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/75bb30d3-ef4a-4147-97a8-621a996611dd agent_type: mysqld_exporter - cluster: test-mysql instance: /agent_id/75bb30d3-ef4a-4147-97a8-621a996611dd node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -547,7 +541,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/f9ab9f7b-5e53-4952-a2e7-ff25fb90fe6a agent_type: mysqld_exporter - cluster: test-remote-mysql instance: /agent_id/f9ab9f7b-5e53-4952-a2e7-ff25fb90fe6a node_id: /node_id/4e2e07dc-40a1-18ca-aea9-d943260a9653 node_name: test-remote-node @@ -585,7 +578,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/f9ab9f7b-5e53-4952-a2e7-ff25fb90fe6a agent_type: mysqld_exporter - cluster: test-remote-mysql instance: /agent_id/f9ab9f7b-5e53-4952-a2e7-ff25fb90fe6a node_id: /node_id/4e2e07dc-40a1-18ca-aea9-d943260a9653 node_name: test-remote-node @@ -629,7 +621,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/f9ab9f7b-5e53-4952-a2e7-ff25fb90fe6a agent_type: mysqld_exporter - cluster: test-remote-mysql instance: /agent_id/f9ab9f7b-5e53-4952-a2e7-ff25fb90fe6a node_id: /node_id/4e2e07dc-40a1-18ca-aea9-d943260a9653 node_name: test-remote-node @@ -662,7 +653,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/29e14468-d479-4b4d-bfb7-4ac2fb865bac agent_type: postgres_exporter - cluster: test-postgresql instance: /agent_id/29e14468-d479-4b4d-bfb7-4ac2fb865bac node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -692,7 +682,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/29e14468-d479-4b4d-bfb7-4ac2fb865bac agent_type: postgres_exporter - cluster: test-postgresql instance: /agent_id/29e14468-d479-4b4d-bfb7-4ac2fb865bac node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node @@ -722,7 +711,6 @@ scrape_configs: _service_label: bar agent_id: /agent_id/29e14468-d479-4b4d-bfb7-4ac2fb865bac agent_type: postgres_exporter - cluster: test-postgresql instance: /agent_id/29e14468-d479-4b4d-bfb7-4ac2fb865bac node_id: /node_id/cc663f36-18ca-40a1-aea9-c6310bb4738d node_name: test-generic-node