diff --git a/managed/models/agent_model.go b/managed/models/agent_model.go index a7f1822804..1707389f62 100644 --- a/managed/models/agent_model.go +++ b/managed/models/agent_model.go @@ -492,6 +492,7 @@ func (s *Agent) DSN(service *Service, dsnParams DSNParams, tdp *DelimiterPair, p dsn := u.String() dsn = strings.ReplaceAll(dsn, url.QueryEscape(tdp.Left), tdp.Left) dsn = strings.ReplaceAll(dsn, url.QueryEscape(tdp.Right), tdp.Right) + dsn = strings.ReplaceAll(dsn, url.QueryEscape("/"), "/") return dsn case PostgresExporterType, QANPostgreSQLPgStatementsAgentType, QANPostgreSQLPgStatMonitorAgentType: diff --git a/managed/models/agent_model_test.go b/managed/models/agent_model_test.go index 4fb68a0a9f..4c321ad424 100644 --- a/managed/models/agent_model_test.go +++ b/managed/models/agent_model_test.go @@ -91,6 +91,7 @@ func TestAgent(t *testing.T) { models.ProxySQLExporterType: "username:s3cur3 p@$$w0r4.@unix(/var/run/mysqld/mysqld.sock)/database?timeout=1s", models.QANMySQLPerfSchemaAgentType: "username:s3cur3 p@$$w0r4.@unix(/var/run/mysqld/mysqld.sock)/database?clientFoundRows=true&parseTime=true&timeout=1s", models.QANMySQLSlowlogAgentType: "username:s3cur3 p@$$w0r4.@unix(/var/run/mysqld/mysqld.sock)/database?clientFoundRows=true&parseTime=true&timeout=1s", + models.MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@/var/run/mysqld/mysqld.sock/database?connectTimeoutMS=1000&directConnection=true&serverSelectionTimeoutMS=1000", } { t.Run(string(typ), func(t *testing.T) { agent.AgentType = typ