Skip to content

Commit

Permalink
PMM-13020 Drop identifier prefixes (#2970)
Browse files Browse the repository at this point in the history
* PMM-13020 Add a db migration

* PMM-13020 strip agent_id, node_id, action_id

* PMM-13020 drop service_id

* PMM-13020 drop machine_id

* PMM-13020 drop location_id

* Update agent/agents/mysql/slowlog/slowlog_test.go

Co-authored-by: Nurlan Moldomurov <nurlan.moldomurov@percona.com>

* PMM-13020 fix wrong strip-offs

* PMM-13020 fix text output spacing

* PMM-13020 fix text output spacing

* PMM-13020 drop role_id migration

* PMM-13020 fix text output spacing

* PMM-13020 fix wrong agent_id

* PMM-13020 fix slowlog jsons

* PMM-13020 fix scrape config and rds tests

* PMM-13020 fix scrape config test

* PMM-13020 fix victoriametrics test

* PMM-13020 fix node_helpers test

* PMM-13020 fix grafana test (name was too long)

* PMM-13020 strip prefixes in qan fixtures

* PMM-13020 fix QAN tests

* PMM-13020 cut the prefix when reading params

* PMM-13020 fix the job_name in vm tests

* PMM-13020 update the docs

---------

Co-authored-by: Nurlan Moldomurov <nurlan.moldomurov@percona.com>
  • Loading branch information
ademidoff and BupycHuk authored Jun 6, 2024
1 parent 483ba4d commit 5543ab4
Show file tree
Hide file tree
Showing 77 changed files with 84,551 additions and 84,488 deletions.
6 changes: 3 additions & 3 deletions admin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ git, make, curl, go, gcc, pmm-server, pmm-agent

You should see something like this
```shell script
Agent ID: /agent_id/fcbe3cb4-a95a-43f4-aef5-c3494caa5132
Node ID : /node_id/77be6b4d-a1d9-4687-8fae-7acbaee7db47
Agent ID: fcbe3cb4-a95a-43f4-aef5-c3494caa5132
Node ID : 77be6b4d-a1d9-4687-8fae-7acbaee7db47
PMM Server:
URL : https://127.0.0.1:443/
Expand All @@ -31,7 +31,7 @@ PMM-agent:
Latency : 211.026µs
Agents:
/agent_id/3329a405-8a5d-4414-9890-b6ae4209e0cc NODE_EXPORTER RUNNING
3329a405-8a5d-4414-9890-b6ae4209e0cc NODE_EXPORTER RUNNING
```
It means that everything works.

Expand Down
2 changes: 1 addition & 1 deletion admin/cmd/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func getDefaultKongOptions(appName string) []kong.Option {

var defaultMachineID string
if nodeinfo.MachineID != "" {
defaultMachineID = "/machine_id/" + nodeinfo.MachineID
defaultMachineID = nodeinfo.MachineID
}

mysqlQuerySources := []string{
Expand Down
60 changes: 30 additions & 30 deletions admin/commands/inventory/add_agent_mysqld_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ func TestAddAgentMysqldExporter(t *testing.T) {
t.Run("TablestatEnabled", func(t *testing.T) {
res := &addAgentMysqldExporterResult{
Agent: &agents.AddAgentOKBodyMysqldExporter{
AgentID: "/agent_id/1",
PMMAgentID: "/agent_id/2",
AgentID: "1",
PMMAgentID: "2",
Username: "username",
ServiceID: "/service_id/1",
ServiceID: "1",
ListenPort: 42001,
Status: pointer.ToString("RUNNING"),

Expand All @@ -42,9 +42,9 @@ func TestAddAgentMysqldExporter(t *testing.T) {
}
expected := strings.TrimSpace(`
Mysqld Exporter added.
Agent ID : /agent_id/1
PMM-Agent ID : /agent_id/2
Service ID : /service_id/1
Agent ID : 1
PMM-Agent ID : 2
Service ID : 1
Username : username
Listen port : 42001
TLS enabled : false
Expand All @@ -62,10 +62,10 @@ Tablestat collectors : enabled (the limit is 1000, the actual table count is 50
t.Run("TablestatEnabledNoLimit", func(t *testing.T) {
res := &addAgentMysqldExporterResult{
Agent: &agents.AddAgentOKBodyMysqldExporter{
AgentID: "/agent_id/1",
PMMAgentID: "/agent_id/2",
AgentID: "1",
PMMAgentID: "2",
Username: "username",
ServiceID: "/service_id/1",
ServiceID: "1",
ListenPort: 42001,
Status: pointer.ToString("RUNNING"),

Expand All @@ -76,9 +76,9 @@ Tablestat collectors : enabled (the limit is 1000, the actual table count is 50
}
expected := strings.TrimSpace(`
Mysqld Exporter added.
Agent ID : /agent_id/1
PMM-Agent ID : /agent_id/2
Service ID : /service_id/1
Agent ID : 1
PMM-Agent ID : 2
Service ID : 1
Username : username
Listen port : 42001
TLS enabled : false
Expand All @@ -96,10 +96,10 @@ Tablestat collectors : enabled (the table count limit is not set).
t.Run("TablestatEnabledUnknown", func(t *testing.T) {
res := &addAgentMysqldExporterResult{
Agent: &agents.AddAgentOKBodyMysqldExporter{
AgentID: "/agent_id/1",
PMMAgentID: "/agent_id/2",
AgentID: "1",
PMMAgentID: "2",
Username: "username",
ServiceID: "/service_id/1",
ServiceID: "1",
ListenPort: 42001,
Status: pointer.ToString("RUNNING"),

Expand All @@ -110,9 +110,9 @@ Tablestat collectors : enabled (the table count limit is not set).
}
expected := strings.TrimSpace(`
Mysqld Exporter added.
Agent ID : /agent_id/1
PMM-Agent ID : /agent_id/2
Service ID : /service_id/1
Agent ID : 1
PMM-Agent ID : 2
Service ID : 1
Username : username
Listen port : 42001
TLS enabled : false
Expand All @@ -130,10 +130,10 @@ Tablestat collectors : enabled (the limit is 1000, the actual table count is un
t.Run("TablestatDisabled", func(t *testing.T) {
res := &addAgentMysqldExporterResult{
Agent: &agents.AddAgentOKBodyMysqldExporter{
AgentID: "/agent_id/1",
PMMAgentID: "/agent_id/2",
AgentID: "1",
PMMAgentID: "2",
Username: "username",
ServiceID: "/service_id/1",
ServiceID: "1",
ListenPort: 42001,
Status: pointer.ToString("RUNNING"),

Expand All @@ -144,9 +144,9 @@ Tablestat collectors : enabled (the limit is 1000, the actual table count is un
}
expected := strings.TrimSpace(`
Mysqld Exporter added.
Agent ID : /agent_id/1
PMM-Agent ID : /agent_id/2
Service ID : /service_id/1
Agent ID : 1
PMM-Agent ID : 2
Service ID : 1
Username : username
Listen port : 42001
TLS enabled : false
Expand All @@ -164,10 +164,10 @@ Tablestat collectors : disabled (the limit is 1000, the actual table count is 2
t.Run("TablestatDisabledAlways", func(t *testing.T) {
res := &addAgentMysqldExporterResult{
Agent: &agents.AddAgentOKBodyMysqldExporter{
AgentID: "/agent_id/1",
PMMAgentID: "/agent_id/2",
AgentID: "1",
PMMAgentID: "2",
Username: "username",
ServiceID: "/service_id/1",
ServiceID: "1",
ListenPort: 42001,
Status: pointer.ToString("RUNNING"),

Expand All @@ -178,9 +178,9 @@ Tablestat collectors : disabled (the limit is 1000, the actual table count is 2
}
expected := strings.TrimSpace(`
Mysqld Exporter added.
Agent ID : /agent_id/1
PMM-Agent ID : /agent_id/2
Service ID : /service_id/1
Agent ID : 1
PMM-Agent ID : 2
Service ID : 1
Username : username
Listen port : 42001
TLS enabled : false
Expand Down
12 changes: 6 additions & 6 deletions admin/commands/inventory/add_agent_postgres_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ func TestAddAgentPostgresExporter(t *testing.T) {
t.Run("TablestatEnabled", func(t *testing.T) {
res := &addAgentPostgresExporterResult{
Agent: &agents.AddAgentOKBodyPostgresExporter{
AgentID: "/agent_id/1",
PMMAgentID: "/agent_id/2",
AgentID: "1",
PMMAgentID: "2",
Username: "username",
ServiceID: "/service_id/1",
ServiceID: "1",
ListenPort: 42001,
Status: pointer.ToString("RUNNING"),
},
}
expected := strings.TrimSpace(`
Postgres Exporter added.
Agent ID : /agent_id/1
PMM-Agent ID : /agent_id/2
Service ID : /service_id/1
Agent ID : 1
PMM-Agent ID : 2
Service ID : 1
Username : username
Listen port : 42001
TLS enabled : false
Expand Down
4 changes: 2 additions & 2 deletions admin/commands/inventory/add_node_remote_rds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
func TestAddNodeRemoteRDS(t *testing.T) {
res := &addNodeRemoteRDSResult{
Node: &nodes.AddNodeOKBodyRemoteRDS{
NodeID: "/node_id/1",
NodeID: "1",
NodeName: "rds1",
Address: "rds-mysql57",
NodeModel: "db.t3.micro",
Expand All @@ -37,7 +37,7 @@ func TestAddNodeRemoteRDS(t *testing.T) {
}
expected := strings.TrimSpace(`
Remote RDS Node added.
Node ID : /node_id/1
Node ID : 1
Node name: rds1
Address : rds-mysql57
Expand Down
8 changes: 4 additions & 4 deletions admin/commands/inventory/add_service_external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func TestAddServiceExternal(t *testing.T) {
t.Run("Basic", func(t *testing.T) {
res := &addServiceExternalResult{
Service: &services.AddServiceOKBodyExternal{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "ClickHouse Service",
NodeID: "/node_id/1",
NodeID: "1",
Environment: "environment",
Cluster: "clickhouse-cluster",
ReplicationSet: "clickhouse-replication-set",
Expand All @@ -37,9 +37,9 @@ func TestAddServiceExternal(t *testing.T) {
},
}
expected := `External Service added.
Service ID : /service_id/1
Service ID : 1
Service name : ClickHouse Service
Node ID : /node_id/1
Node ID : 1
Environment : environment
Cluster name : clickhouse-cluster
Replication set: clickhouse-replication-set
Expand Down
8 changes: 4 additions & 4 deletions admin/commands/inventory/add_service_haproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ func TestAddServiceHAProxy(t *testing.T) {
t.Run("Basic", func(t *testing.T) {
res := &addServiceHAProxyResult{
Service: &services.AddServiceOKBodyHaproxy{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "ClickHouse Service",
NodeID: "/node_id/1",
NodeID: "1",
Environment: "environment",
Cluster: "clickhouse-cluster",
ReplicationSet: "clickhouse-replication-set",
CustomLabels: map[string]string{"key": "value", "foo": "bar"},
},
}
expected := `HAProxy Service added.
Service ID : /service_id/1
Service ID : 1
Service name : ClickHouse Service
Node ID : /node_id/1
Node ID : 1
Environment : environment
Cluster name : clickhouse-cluster
Replication set: clickhouse-replication-set
Expand Down
16 changes: 8 additions & 8 deletions admin/commands/inventory/add_service_mongodb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func TestAddServiceMongoDB(t *testing.T) {
t.Run("Address and port", func(t *testing.T) {
res := &addServiceMongoDBResult{
Service: &services.AddServiceOKBodyMongodb{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "MongoDB Service",
NodeID: "/node_id/1",
NodeID: "1",
Address: "127.0.0.1",
Port: 27017,
Environment: "environment",
Expand All @@ -38,9 +38,9 @@ func TestAddServiceMongoDB(t *testing.T) {
},
}
expected := `MongoDB Service added.
Service ID : /service_id/1
Service ID : 1
Service name : MongoDB Service
Node ID : /node_id/1
Node ID : 1
Address : 127.0.0.1
Port : 27017
Environment : environment
Expand All @@ -54,9 +54,9 @@ Custom labels : map[foo:bar key:value]
t.Run("Socket", func(t *testing.T) {
res := &addServiceMongoDBResult{
Service: &services.AddServiceOKBodyMongodb{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "MongoDB Socket Service",
NodeID: "/node_id/1",
NodeID: "1",
Socket: "/tmp/mongodb-27017.sock",
Environment: "environment",
Cluster: "mongodb-cluster",
Expand All @@ -65,9 +65,9 @@ Custom labels : map[foo:bar key:value]
},
}
expected := `MongoDB Service added.
Service ID : /service_id/1
Service ID : 1
Service name : MongoDB Socket Service
Node ID : /node_id/1
Node ID : 1
Socket : /tmp/mongodb-27017.sock
Environment : environment
Cluster name : mongodb-cluster
Expand Down
16 changes: 8 additions & 8 deletions admin/commands/inventory/add_service_mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func TestAddServiceMySQL(t *testing.T) {
t.Run("Address and port", func(t *testing.T) {
res := &addServiceMySQLResult{
Service: &services.AddServiceOKBodyMysql{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "MySQL Service",
NodeID: "/node_id/1",
NodeID: "1",
Address: "127.0.0.1",
Port: 3306,
Environment: "environment",
Expand All @@ -38,9 +38,9 @@ func TestAddServiceMySQL(t *testing.T) {
},
}
expected := `MySQL Service added.
Service ID : /service_id/1
Service ID : 1
Service name : MySQL Service
Node ID : /node_id/1
Node ID : 1
Address : 127.0.0.1
Port : 3306
Environment : environment
Expand All @@ -54,9 +54,9 @@ Custom labels : map[foo:bar key:value]
t.Run("Socket", func(t *testing.T) {
res := &addServiceMySQLResult{
Service: &services.AddServiceOKBodyMysql{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "MySQL Socket Service",
NodeID: "/node_id/1",
NodeID: "1",
Socket: "/path/to/socket",
Environment: "environment",
Cluster: "mysql-cluster",
Expand All @@ -65,9 +65,9 @@ Custom labels : map[foo:bar key:value]
},
}
expected := `MySQL Service added.
Service ID : /service_id/1
Service ID : 1
Service name : MySQL Socket Service
Node ID : /node_id/1
Node ID : 1
Socket : /path/to/socket
Environment : environment
Cluster name : mysql-cluster
Expand Down
16 changes: 8 additions & 8 deletions admin/commands/inventory/add_service_postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ func TestAddServicePostgreSQL(t *testing.T) {
t.Run("Address and port", func(t *testing.T) {
res := &addServicePostgreSQLResult{
Service: &services.AddServiceOKBodyPostgresql{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "PostgreSQL Service",
NodeID: "/node_id/1",
NodeID: "1",
Address: "127.0.0.1",
Port: 5432,
Environment: "environment",
Expand All @@ -38,9 +38,9 @@ func TestAddServicePostgreSQL(t *testing.T) {
},
}
expected := `PostgreSQL Service added.
Service ID : /service_id/1
Service ID : 1
Service name : PostgreSQL Service
Node ID : /node_id/1
Node ID : 1
Address : 127.0.0.1
Port : 5432
Environment : environment
Expand All @@ -54,9 +54,9 @@ Custom labels : map[foo:bar key:value]
t.Run("Socket", func(t *testing.T) {
res := &addServicePostgreSQLResult{
Service: &services.AddServiceOKBodyPostgresql{
ServiceID: "/service_id/1",
ServiceID: "1",
ServiceName: "PostgreSQL Socket Service",
NodeID: "/node_id/1",
NodeID: "1",
Socket: "/var/run/postgresql",
Environment: "environment",
Cluster: "postgresql-cluster",
Expand All @@ -65,9 +65,9 @@ Custom labels : map[foo:bar key:value]
},
}
expected := `PostgreSQL Service added.
Service ID : /service_id/1
Service ID : 1
Service name : PostgreSQL Socket Service
Node ID : /node_id/1
Node ID : 1
Socket : /var/run/postgresql
Environment : environment
Cluster name : postgresql-cluster
Expand Down
Loading

0 comments on commit 5543ab4

Please sign in to comment.