From fe495cc58f9f84e1bacd7302739e9bab3af1ad72 Mon Sep 17 00:00:00 2001 From: Alex Tymchuk Date: Wed, 13 Sep 2023 13:43:34 +0300 Subject: [PATCH] PMM-11670 Set the cluster label if empty (#2459) * PMM-11670 make sure cluster label is not empty * PMM-11670 fix tests in managed/models * PMM-11670 fix inventory tests * PMM-11670 fix tests in managed/qan * PMM-11670 fix tests in managed/services/victoriametrics * PMM-11670 fix API tests * PMM-11670 update API tests * PMM-11670 remove the deprecated parameter * PMM-11670 beautify the debug print --------- Co-authored-by: Matej Kubinec --- .github/workflows/managed.yml | 7 ++-- api-tests/inventory/nodes_test.go | 1 + 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 +++++++ 15 files changed, 104 insertions(+), 24 deletions(-) diff --git a/.github/workflows/managed.yml b/.github/workflows/managed.yml index 5ea6d0a803..ab1c5b8dcf 100644 --- a/.github/workflows/managed.yml +++ b/.github/workflows/managed.yml @@ -107,9 +107,6 @@ jobs: - name: Run debug commands on failure if: ${{ failure() }} run: | - env - go version - go env - pwd + env | sort + go env | sort git status - kubectl version --output json diff --git a/api-tests/inventory/nodes_test.go b/api-tests/inventory/nodes_test.go index e3adc01ac9..f2f9c52d86 100644 --- a/api-tests/inventory/nodes_test.go +++ b/api-tests/inventory/nodes_test.go @@ -401,6 +401,7 @@ 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 21c83853bf..33e032428e 100644 --- a/api-tests/inventory/services_test.go +++ b/api-tests/inventory/services_test.go @@ -352,6 +352,7 @@ func TestMySQLService(t *testing.T) { Address: "localhost", Port: 3306, ServiceName: serviceName, + Cluster: serviceName, }, }, }, res) @@ -372,6 +373,7 @@ func TestMySQLService(t *testing.T) { Address: "localhost", Port: 3306, ServiceName: serviceName, + Cluster: serviceName, }, }, }, serviceRes) @@ -553,6 +555,7 @@ func TestMongoDBService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "localhost", Port: 27017, }, @@ -573,6 +576,7 @@ func TestMongoDBService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "localhost", Port: 27017, }, @@ -729,6 +733,7 @@ func TestMongoDBService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, + Cluster: serviceName, Socket: "/tmp/mongodb-27017.sock", }, }, @@ -770,6 +775,7 @@ func TestPostgreSQLService(t *testing.T) { DatabaseName: defaultPostgresDBName, Port: 5432, ServiceName: serviceName, + Cluster: serviceName, }, }, }, res) @@ -791,6 +797,7 @@ func TestPostgreSQLService(t *testing.T) { DatabaseName: defaultPostgresDBName, Port: 5432, ServiceName: serviceName, + Cluster: serviceName, }, }, }, serviceRes) @@ -973,6 +980,7 @@ func TestProxySQLService(t *testing.T) { Address: "localhost", Port: 5432, ServiceName: serviceName, + Cluster: serviceName, }, }, }, res) @@ -993,6 +1001,7 @@ func TestProxySQLService(t *testing.T) { Address: "localhost", Port: 5432, ServiceName: serviceName, + Cluster: serviceName, }, }, }, serviceRes) @@ -1184,6 +1193,7 @@ func TestExternalService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, + Cluster: serviceName, Group: "redis", }, }, @@ -1203,6 +1213,7 @@ func TestExternalService(t *testing.T) { ServiceID: serviceID, NodeID: genericNodeID, ServiceName: serviceName, + Cluster: serviceName, Group: "redis", }, }, @@ -1334,6 +1345,7 @@ 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 78dce3c34b..f87fa9ec58 100644 --- a/api-tests/management/external_test.go +++ b/api-tests/management/external_test.go @@ -74,6 +74,7 @@ func TestAddExternal(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Group: "external", }, }, *serviceOK.Payload) @@ -225,6 +226,7 @@ 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 779891b82a..e805be8de8 100644 --- a/api-tests/management/haproxy_test.go +++ b/api-tests/management/haproxy_test.go @@ -76,6 +76,7 @@ func TestAddHAProxy(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, }, }, *serviceOK.Payload) @@ -225,6 +226,7 @@ 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 b65f317a03..98d137f939 100644 --- a/api-tests/management/mongodb_test.go +++ b/api-tests/management/mongodb_test.go @@ -79,6 +79,7 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -154,6 +155,7 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -389,6 +391,7 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -607,6 +610,7 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Socket: "/tmp/mongodb-27017.sock", }, }, *serviceOK.Payload) @@ -678,6 +682,7 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -750,6 +755,7 @@ func TestAddMongoDB(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -821,6 +827,7 @@ 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 12e6c0fe6e..0b93e7f90d 100644 --- a/api-tests/management/mysql_test.go +++ b/api-tests/management/mysql_test.go @@ -80,6 +80,7 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -159,6 +160,7 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -413,6 +415,7 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 27017, }, @@ -666,6 +669,7 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -741,6 +745,7 @@ func TestAddMySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -815,6 +820,7 @@ 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 4f21927b49..23bd00629c 100644 --- a/api-tests/management/postgresql_test.go +++ b/api-tests/management/postgresql_test.go @@ -82,6 +82,7 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -161,6 +162,7 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -261,6 +263,7 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -410,6 +413,7 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: newNodeID, ServiceName: serviceName, + Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 27017, @@ -636,6 +640,7 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -711,6 +716,7 @@ func TestAddPostgreSQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, DatabaseName: defaultPostgresDBName, Address: "10.10.10.10", Port: 5432, @@ -785,6 +791,7 @@ 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 79c1e4962b..d3b823e54e 100644 --- a/api-tests/management/proxysql_test.go +++ b/api-tests/management/proxysql_test.go @@ -80,6 +80,7 @@ func TestAddProxySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -155,6 +156,7 @@ func TestAddProxySQL(t *testing.T) { ServiceID: serviceID, NodeID: nodeID, ServiceName: serviceName, + Cluster: serviceName, Address: "10.10.10.10", Port: 3306, }, @@ -260,13 +262,12 @@ 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, }, } @@ -386,6 +387,7 @@ 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 fc107aadc1..9aeda6c39a 100644 --- a/managed/models/database.go +++ b/managed/models/database.go @@ -916,6 +916,9 @@ var databaseSchema = [][]string{ ALTER COLUMN comments_parsing_disabled DROP DEFAULT`, }, 85: { + `UPDATE services SET cluster = service_name WHERE cluster = ''`, + }, + 86: { `ALTER TABLE services ADD COLUMN version VARCHAR NOT NULL DEFAULT ''`, }, diff --git a/managed/models/service_helpers_test.go b/managed/models/service_helpers_test.go index 07e4773a45..95e38b02fa 100644 --- a/managed/models/service_helpers_test.go +++ b/managed/models/service_helpers_test.go @@ -158,10 +158,11 @@ 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, services, []*models.Service{{ + assert.Equal(t, []*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), @@ -171,6 +172,7 @@ 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), @@ -180,35 +182,38 @@ 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, services, []*models.Service{{ + assert.Equal(t, []*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, services, []*models.Service{ + assert.Equal(t, []*models.Service{ { ServiceID: "S4", ServiceType: models.ExternalServiceType, ServiceName: "Fourth service", + Cluster: "Fourth service", ExternalGroup: "external", NodeID: "N2", CreatedAt: now, @@ -218,6 +223,7 @@ 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), @@ -225,47 +231,50 @@ 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, services, []*models.Service{{ + assert.Equal(t, []*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, services, []*models.Service{{ + assert.Equal(t, []*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, services, []*models.Service{{ + assert.Equal(t, []*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 85e5baec81..2026489eec 100644 --- a/managed/models/service_model.go +++ b/managed/models/service_model.go @@ -75,6 +75,9 @@ func (s *Service) BeforeInsert() error { if len(s.CustomLabels) == 0 { s.CustomLabels = nil } + if s.Cluster == "" { + s.Cluster = s.ServiceName + } return nil } @@ -84,6 +87,9 @@ 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 ad5549a00c..c908cbb333 100644 --- a/managed/services/inventory/services_test.go +++ b/managed/services/inventory/services_test.go @@ -104,6 +104,7 @@ 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, @@ -259,6 +260,7 @@ 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", } @@ -333,6 +335,7 @@ 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, @@ -374,6 +377,7 @@ 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", @@ -414,6 +418,7 @@ 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", @@ -492,6 +497,7 @@ 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, @@ -531,6 +537,7 @@ 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", } @@ -602,6 +609,7 @@ 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) @@ -639,6 +647,7 @@ 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", } @@ -730,6 +739,7 @@ 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 e48d5c7503..dc4bc1887e 100644 --- a/managed/services/qan/client_test.go +++ b/managed/services/qan/client_test.go @@ -185,6 +185,7 @@ 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", @@ -254,6 +255,7 @@ 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", @@ -352,6 +354,7 @@ 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", @@ -492,6 +495,7 @@ 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 6eb19fcd9c..995cedf740 100644 --- a/managed/services/victoriametrics/victoriametrics_test.go +++ b/managed/services/victoriametrics/victoriametrics_test.go @@ -336,6 +336,7 @@ 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 @@ -366,6 +367,7 @@ 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 @@ -396,6 +398,7 @@ 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 @@ -428,6 +431,7 @@ 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 @@ -465,6 +469,7 @@ 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 @@ -508,6 +513,7 @@ 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 @@ -540,6 +546,7 @@ 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 @@ -577,6 +584,7 @@ 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 @@ -620,6 +628,7 @@ 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 @@ -652,6 +661,7 @@ 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 @@ -681,6 +691,7 @@ 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 @@ -710,6 +721,7 @@ 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