-
Notifications
You must be signed in to change notification settings - Fork 39
Conversation
Codecov Report
@@ Coverage Diff @@
## PMM-2.0 #528 +/- ##
===========================================
- Coverage 49.66% 49.46% -0.20%
===========================================
Files 123 123
Lines 15453 15547 +94
===========================================
+ Hits 7674 7690 +16
- Misses 7067 7148 +81
+ Partials 712 709 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
models/agent_model.go
Outdated
TLSSkipVerify bool `reform:"tls_skip_verify"` | ||
TLSCertificateKey string `reform:"tls_certificate_key"` | ||
TLSCertificateKeyFilePassword string `reform:"tls_certificate_key_file_password"` | ||
TLSCaKey string `reform:"tls_ca_key"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JiriCtvrtka @BupycHuk I think it might be a time for us to start adding those new properties into a single JSON column
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, it might be good reason for that and probably we will need one more task to move other additional fields to single json column.
Other question is should we use the same column for all fields or split them by groups? Using separate columns for each service type will be easier to unmarshal and keep only required field. what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate columns for each service type
Sounds good
We should also update pmm-managed/models/agent_model.go Lines 233 to 271 in aa87f50
|
Please resolve conflict |
models/agent_model.go
Outdated
@@ -275,7 +310,10 @@ func (s *Agent) DSN(service *Service, dialTimeout time.Duration, database string | |||
case username != "": | |||
u.User = url.User(username) | |||
} | |||
return u.String() | |||
dsn := u.String() | |||
dsn = strings.Replace(dsn, url.QueryEscape(tdp.Left), tdp.Left, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be ReplaceAll()
# Conflicts: # Gopkg.lock
@@ -169,13 +188,17 @@ func (s *Agent) UnifiedLabels() (map[string]string, error) { | |||
} | |||
|
|||
// DSN returns DSN string for accessing given Service with this Agent (and implicit driver). | |||
func (s *Agent) DSN(service *Service, dialTimeout time.Duration, database string) string { | |||
func (s *Agent) DSN(service *Service, dialTimeout time.Duration, database string, tdp *DelimiterPair) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
Function 'DSN' has too many statements (96 > 40) (funlen)
} | ||
require.Len(t, actualAgents, 11) | ||
|
||
// TODO: fix protobuf equality https://jira.percona.com/browse/PMM-6743 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
services/inventory/agents_test.go:254: Line contains TODO/BUG/FIXME: "TODO: fix protobuf equality https://jira..." (godox)
models/agent_model_test.go
Outdated
@@ -110,21 +116,27 @@ func TestAgent(t *testing.T) { | |||
ProxySQLExporterType: "username:s3cur3 p@$$w0r4.@tcp(1.2.3.4:12345)/database?timeout=1s&tls=true", | |||
QANMySQLPerfSchemaAgentType: "username:s3cur3 p@$$w0r4.@tcp(1.2.3.4:12345)/database?clientFoundRows=true&parseTime=true&timeout=1s&tls=true", | |||
QANMySQLSlowlogAgentType: "username:s3cur3 p@$$w0r4.@tcp(1.2.3.4:12345)/database?clientFoundRows=true&parseTime=true&timeout=1s&tls=true", | |||
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | |||
QANMongoDBProfilerAgentType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | |||
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true&sslCaFile={{.TextFiles.caFilePlaceholder}}&sslCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}&sslCertificateKeyFilePassword=pass", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 282 characters (lll)
models/agent_model_test.go
Outdated
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | ||
QANMongoDBProfilerAgentType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | ||
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true&sslCaFile={{.TextFiles.caFilePlaceholder}}&sslCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}&sslCertificateKeyFilePassword=pass", | ||
QANMongoDBProfilerAgentType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true&sslCaFile={{.TextFiles.caFilePlaceholder}}&sslCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}&sslCertificateKeyFilePassword=pass", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 282 characters (lll)
models/agent_model_test.go
Outdated
|
||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?connectTimeoutMS=1000&ssl=true", agent.DSN(service, time.Second, "")) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?ssl=true", agent.DSN(service, 0, "")) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?connectTimeoutMS=1000&ssl=true&sslCaFile={{.TextFiles.caFilePlaceholder}}&sslCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}", agent.DSN(service, time.Second, "", nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 268 characters (lll)
models/dsn_helpers_test.go
Outdated
|
||
dsn, agent, err := models.FindDSNByServiceIDandPMMAgentID(q, "S4", "PA2", "test") | ||
require.NoError(t, err) | ||
expected := "mongodb://pmm-user%7B%7B@127.0.0.1:27017/test?connectTimeoutMS=1000&ssl=true&sslCaFile=[[.TextFiles.caFilePlaceholder]]&sslCertificateKeyFile=[[.TextFiles.certificateKeyFilePlaceholder]]&sslCertificateKeyFilePassword=passwordoftls" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 252 characters (lll)
@@ -887,13 +893,18 @@ func (r *Registry) StartPostgreSQLShowIndexAction(ctx context.Context, id, pmmAg | |||
} | |||
|
|||
// StartMongoDBExplainAction starts MongoDB query explain action on pmm-agent. | |||
func (r *Registry) StartMongoDBExplainAction(ctx context.Context, id, pmmAgentID, dsn, query string) error { | |||
func (r *Registry) StartMongoDBExplainAction(ctx context.Context, id, pmmAgentID, dsn, query string, files map[string]string, tdp *models.DelimiterPair) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶(*Registry).StartMongoDBExplainAction
- ctx
is unused (unparam)
@@ -996,12 +1007,17 @@ func (r *Registry) StartPostgreSQLQuerySelectAction(ctx context.Context, id, pmm | |||
} | |||
|
|||
// StartMongoDBQueryGetParameterAction starts MongoDB getParameter query action on pmm-agent. | |||
func (r *Registry) StartMongoDBQueryGetParameterAction(ctx context.Context, id, pmmAgentID, dsn string) error { | |||
func (r *Registry) StartMongoDBQueryGetParameterAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶(*Registry).StartMongoDBQueryGetParameterAction
- ctx
is unused (unparam)
@@ -1017,12 +1033,17 @@ func (r *Registry) StartMongoDBQueryGetParameterAction(ctx context.Context, id, | |||
} | |||
|
|||
// StartMongoDBQueryBuildInfoAction starts MongoDB buildInfo query action on pmm-agent. | |||
func (r *Registry) StartMongoDBQueryBuildInfoAction(ctx context.Context, id, pmmAgentID, dsn string) error { | |||
func (r *Registry) StartMongoDBQueryBuildInfoAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶(*Registry).StartMongoDBQueryBuildInfoAction
- ctx
is unused (unparam)
@@ -1038,12 +1059,17 @@ func (r *Registry) StartMongoDBQueryBuildInfoAction(ctx context.Context, id, pmm | |||
} | |||
|
|||
// StartMongoDBQueryGetCmdLineOptsAction starts MongoDB getCmdLineOpts query action on pmm-agent. | |||
func (r *Registry) StartMongoDBQueryGetCmdLineOptsAction(ctx context.Context, id, pmmAgentID, dsn string) error { | |||
func (r *Registry) StartMongoDBQueryGetCmdLineOptsAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶(*Registry).StartMongoDBQueryGetCmdLineOptsAction
- ctx
is unused (unparam)
@@ -110,21 +116,27 @@ func TestAgent(t *testing.T) { | |||
ProxySQLExporterType: "username:s3cur3 p@$$w0r4.@tcp(1.2.3.4:12345)/database?timeout=1s&tls=true", | |||
QANMySQLPerfSchemaAgentType: "username:s3cur3 p@$$w0r4.@tcp(1.2.3.4:12345)/database?clientFoundRows=true&parseTime=true&timeout=1s&tls=true", | |||
QANMySQLSlowlogAgentType: "username:s3cur3 p@$$w0r4.@tcp(1.2.3.4:12345)/database?clientFoundRows=true&parseTime=true&timeout=1s&tls=true", | |||
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | |||
QANMongoDBProfilerAgentType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | |||
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true&tlsCaFile={{.TextFiles.caFilePlaceholder}}&tlsCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}&tlsCertificateKeyFilePassword=pass", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 282 characters (lll)
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | ||
QANMongoDBProfilerAgentType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true", | ||
MongoDBExporterType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true&tlsCaFile={{.TextFiles.caFilePlaceholder}}&tlsCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}&tlsCertificateKeyFilePassword=pass", | ||
QANMongoDBProfilerAgentType: "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/database?connectTimeoutMS=1000&ssl=true&tlsCaFile={{.TextFiles.caFilePlaceholder}}&tlsCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}&tlsCertificateKeyFilePassword=pass", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 282 characters (lll)
|
||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?connectTimeoutMS=1000&ssl=true", agent.DSN(service, time.Second, "")) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?ssl=true", agent.DSN(service, 0, "")) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?connectTimeoutMS=1000&ssl=true&tlsCaFile={{.TextFiles.caFilePlaceholder}}&tlsCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}", agent.DSN(service, time.Second, "", nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 268 characters (lll)
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?connectTimeoutMS=1000&ssl=true", agent.DSN(service, time.Second, "")) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?ssl=true", agent.DSN(service, 0, "")) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?connectTimeoutMS=1000&ssl=true&tlsCaFile={{.TextFiles.caFilePlaceholder}}&tlsCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}", agent.DSN(service, time.Second, "", nil)) | ||
assert.Equal(t, "mongodb://username:s3cur3%20p%40$$w0r4.@1.2.3.4:12345/?ssl=true&tlsCaFile={{.TextFiles.caFilePlaceholder}}&tlsCertificateKeyFile={{.TextFiles.certificateKeyFilePlaceholder}}", agent.DSN(service, 0, "", nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 236 characters (lll)
|
||
dsn, agent, err := models.FindDSNByServiceIDandPMMAgentID(q, "S4", "PA2", "test") | ||
require.NoError(t, err) | ||
expected := "mongodb://pmm-user%7B%7B@127.0.0.1:27017/test?connectTimeoutMS=1000&ssl=true&tlsCaFile=[[.TextFiles.caFilePlaceholder]]&tlsCertificateKeyFile=[[.TextFiles.certificateKeyFilePlaceholder]]&tlsCertificateKeyFilePassword=passwordoftls" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [golangci-lint] reported by reviewdog 🐶
line is 252 characters (lll)
# Conflicts: # Gopkg.lock
* PMM-5364 Deps. * PMM-5364 Add new fields to add request. * PMM-5364 Deps. * PMM-5364 Deps. * PMM-5364 Add new fields into DB. * PMM-5364 Reform. * PMM-5364 Another fields changes. * PMM-5364 Deps. * PMM-5364 Deps. * PMM-5364 Fields. * PMM-5364 Deps. * PMM-7026 One more revert. * PMM-7026 Deps. * PMM-5364 Changes fields into struct. * PMM-5364 Fix. * PMM-5364 Changes. * PMM-5364 Deps. * PMM-5364 Gen. * PMM-5364 Deps. * PMM-5364 Add TLS keys to MongoDBExplainAction request. * PMM-5364 Remove old code. * PMM-5364 Changes. * PMM-5364 Fix new db fields VM problem. * PMM-5364 Naming changes. * PMM-5364 Changes. * PMM-5364 Deps. * PMM-5364 Deps. * PMM-5364 Fix build. * PMM-5364 Fix test. * PMM-5367 Changes. * PMM-5364 Deps. * PMM-5364 Set default prefix to same. * PMM-5364 Places for paste creating certs. * PMM-5364 Fix test. * PMM-5364 Fix test. * PMM-5364 Make MongoDBOptions struct. * PMM-5364 Fix tests. * PMM-5364 Use text files parameters as .TextFiles. . * PMM-5364 Use text files parameters as .TextFiles . * PMM-5364 Refactoring . * PMM-5364 Fix connection checker. * PMM-5364 Fix tests. * PMM-5364 Fix QAN MongoDB Profiler. * PMM-5364 Fix Explain Action for MongoDB SSL. * PMM-5364 Fix merge conflicts. Co-authored-by: Nurlan Moldomurov <nurlan.moldomurov@percona.com> Co-authored-by: Alexey Palazhchenko <alexey.palazhchenko@percona.com>
PMM-5364
Build: https://github.com/Percona-Lab/pmm-submodules/pull/0
Links to other linked pull requests (optional).
PMM: PMM-5364 SSL support for Mongo. pmm#618
PMM Admin: PMM-5364 SSL support for Mongo. pmm-admin#126
PMM Agent: PMM-5364 SSL support for Mongo. pmm-agent#210